# DSA Original.pdf - Acknowledgement I owe a great many...

• 35

This preview shows page 1 - 5 out of 35 pages.

Edexel HND in Computing and Systems Development (System Development) P a g e | 1 J. Zandrin Nathanial
Thank you
Edexel HND in Computing and Systems Development (System Development) P a g e | 2 J. Zandrin Nathanial Content Contents Acknowledgement ......................................................................................................................1 Content ............................................................................................................................................2 Task 01 ............................................................................................................................................3 T1.1 Describe the Array, Queue, Stack, List (Singly- Linked List, Link Doubly Linked List) and tree Data Structures .............................................................................................................3 T1.2 Describe the above data structures operations .................................................................8 T1.3 What are the Advantages and Disadvantages of above data structures........................13 T1.4 Discuss the situations of those structures will be used in real world, using suitable examples ....................................................................................................................................19 T1.5 Explain the operation of recursive algorithms and identify situations when recursion is used ............................................................................................................................................22 Task 02 ..........................................................................................................................................25 Task 03 ..........................................................................................................................................29 Task 04 ..........................................................................................................................................31
Edexel HND in Computing and Systems Development (System Development) P a g e | 3 J. Zandrin Nathanial Arrays An array is like a cow train which loads cow in every compartment, likewise here the cow is the data type which can be declared as primitive data types and the compartment is the indexes, the number of compartment or the cows that the train can carry. The use of arrays may allow us to simplify our processing. We can use arrays to help read and analyse repetitive data with a minimum of coding. An array and a loop can make the program smaller. For example, suppose we have a file where each record contains 24 values with the temperatures for each hour of the day. These temperatures are in Fahrenheit and we need to convert them to 24 Celsius values. Without arrays we need to repeat the same calculation for all 24 temperature variables: Figure 1.a.1, cs.utsa.edu, (2015) An alternative is to define arrays and use a loop to process the calculation for all variables: Figure 1.a.2, cs.utsa.edu, (2015) While in this example there are only 24 elements in each array, it would work just as well with hundreds of elements. In addition to simplifying the calculations, by defining arrays for the temperature values we could also have used them in the input statement to simplify the input process. It should also Task 01 a)Describe the Array, Queue, Stack, List (Singly- Linked List, Link Doubly Linked List) and tree Data Structures
Edexel HND in Computing and Systems Development (System Development) P a g e | 4 J. Zandrin Nathanial be noted, while TEMP1 is equivalent to the first element, TEMP2 to the second etc., the variables do not need to be named consecutively. The array would work just as well with non-consecutive variable names. Array: sample_array {5} x a i r d; In this example, the variable x is equivalent to the first element, to the second etc.