Algorithms and Data structures in Programming.

Balwisa Mercy
3 min readSep 20, 2019

--

1.Algorithms

In programming, algorithm is a set of well defined instructions in sequence to solve the problem.

Qualities of a good algorithm

  1. Input and output should be defined precisely.
  2. Each steps in algorithm should be clear and unambiguous.
  3. Algorithm should be most effective among many different ways to solve a problem.
  4. An algorithm shouldn’t have computer code. Instead, the algorithm should be written in such a way that, it can be used in similar programming languages.

Examples of algorithms

An algorithm to find the largest among three different numbers entered by user.

The above solution shows the different steps of finding the largest number

All around us, algorithms are invisibly at work. They’re recommending music and surfacing news, finding cancerous tumors, and making self-driving cars a reality. But do people trust them?

Not really, according to a Pew Research Center survey taken last year. When asked whether computer programs will always reflect the biases of their designers, 58 percent of respondents thought they would. This finding illustrates a serious tension between computing technology, whose influence on people’s lives is only expected to grow, and the people affected by it.

The lack of trust in any particular technology impedes its acceptance and use. On one hand, justified distrust of dangerous technology is a good thing. Nobody objects to eliminating the use of bad algorithms that have undesirable consequences, such as the Therac-25 software that delivered radiation overdoses to patients or the incorrect unit computation that caused NASA to lose its Mars Climate Orbiter. On the other hand, people’s irrational fear of safe technology, such as vaccination, can itself be dangerous. It is not only that those who distrust technology will personally miss out on the benefits, but their refusal to participate can negatively affect other people and have an overall detrimental effect on society.

2.Data structures

A data structure is a particular way of organizing data in a computer so that it can be used effectively.

Data structure are methods of organizing units of data within larger data sets. Achieving and maintaining specific data structures help improve data access and value. Data structures also help programmers implement various programming tasks.

Looking at basic examples is an effective way to understand data structures. For example, a very basic example of a data structure is an array, in which multiple data bits are coordinated into a group sharing a common label. This helps programs call these data bits or perform other work on the data set as a whole. Another example of a data structure is a stack, which places data units in relative hierarchies, allowing code functions to work on the data in coordinated ways, such as pushing a new data unit into a stack, or popping a data unit from the top of a stack.

In a general sense, the data structure concept dovetails with that of virtual objects and virtual reality. As data is more elaborately arranged by developers and others, the data becomes more functional, allowing the emergence of a virtual reality. This is a core concept of many technological advances from the last few decades.

I used and Arrays in solving most of my java script challenges and would like to share my solutions here;

challenge : write a function that takes the array and returns an object with property names evens, odds, and chars. The value for evens is an array of sorted even numbers and odds is an array of sorted odd numbers and chars is an array of sorted character strings

My solution

References:

https://www.msn.com/en-my/news/techandscience/algorithms-arent-all-created-equal/ar-AAHn2IC?li=BBr91nf

https://www.techopedia.com/definition/1149/data-structure

https://www.msn.com/en-my/news/techandscience/algorithms-arent-all-created-equal/ar-AAHn2IC?li=BBr91nf

--

--

Balwisa Mercy
0 Followers

sometimes we have the dream but we are not ourselves ready for the dream,we have to grow and meet it.