티스토리 뷰

Programming

Algorithm & Data structure

seoca 2019. 1. 20. 17:45




Algorithm & Data structure 



What are Algorithms and Data structures?



The data structure is those different ways of storing data on your program. 

e.g. Array, List, Stack, Queue, Tree, Hash etc,


The algorithm is operations on different data structures + sets of instructions for executing them. 

e.g. Sort, Search, Max, Min etc,




Let's see the image to get a concrete example. 




We can see alphabet A to E and each path connecting one character to another one. when it comes to algorithms, it is about how to solve a problem. Let's say we need a shorted path A to E using the picture.


First, you need to check all the alphabet we have on the picture 

Second, you also need the paths connecting each character

Third, the distance of each path is required to be checked to measure.

Fourth, try the path based on previous steps

Last, find the shortest path.


this step is an example of what an algorithm is.

But an algorithm would be somewhat different if you use a different type of data structure.


Data structure is a data organization and storage format that enables efficient access and modification.


For example, alphabet A has paths to A to C and A to D. let's make a table for that.


A

A to C, A to D 

 B

B to C, B to E 

 C

C toA, C to B, C to D, C to E 

 D

D to A, D to C, D to E 

  E 

E to D, E to C, E to B 


And we can have another type of table.


A to C 

 A to D 

B to C

B to E 

 C to D 

C to E

D to E



two tables have a different data structure. So these are the example of data structure. 

The first table looks like Array or List and the Second looks like HashTable or HashMap data structure. 





Reference

https://en.wikipedia.org/wiki/Data_structure

https://www.youtube.com/watch?v=bum_19

https://en.wikipedia.org/wiki/Algorithmloj9A&list=PLBZBJbE_rGRV8D7XZ08LK6z-4zPoWzu5H

'Programming' 카테고리의 다른 글

Static URL & Dynamic URL  (0) 2019.02.28
Http Response & Http Status Code  (0) 2019.02.27
Web app vs Mobile app  (0) 2019.01.20
difference between Framework and Library  (0) 2019.01.11
RestAPI  (0) 2019.01.10