0% found this document useful (0 votes)
8 views

Why Adjusted Data Structure and Algorithm - Edited

The document discusses different data structures and algorithms covered over six weeks in a course, including stacks, queues, analysis of algorithms, elementary sorts, merge sort, and quicksort. Key topics are the use and implementation of different data structures and sorting algorithms.

Uploaded by

Abdizo Dizo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Why Adjusted Data Structure and Algorithm - Edited

The document discusses different data structures and algorithms covered over six weeks in a course, including stacks, queues, analysis of algorithms, elementary sorts, merge sort, and quicksort. Key topics are the use and implementation of different data structures and sorting algorithms.

Uploaded by

Abdizo Dizo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Data Structure 1

Data Structure and Algorithm

Students Name

Institution Affiliation

Course

Date
Data Structure 2

Data structure and algorithm is a course that focuses on how basic computer science

concepts can be understood rather than dealing with designing and creating programs. The

course, this way, didn't need quite a bit of creating programs by utilizing the programing

language Algorithms is one of the principal areas of computer science, both as far as educating

and exploration. It is essential to prepare information because we need versatile solutions, mostly

used in sciences and industries. In Computers for Circuit layout, in Computer graphics for

Movies and video games, in Security for voting machines, algorithms are necessary for different

fields such as the Internet for browsing web and routing of packets, In Biology, is used for the

project such as genome of human, in Computer graphics for Movies and video games, in

Security for voting machines, and multimedia for MP3, JPG, DivX and HDTV. Algorithms are

measured using their efficiencies, including time efficiency and Space efficiency (Sedgewick &

Wayne, 2011). It depends on the speed and memory usage.

WEEK ONE

a. Theoretical discussion

Topic cover in the week involved the understanding of stacks. Stacks are the most

suitable data structure for modelling a First in Last Out (FILO) or Last In First Out (LIFO)

strategy in search. (Catchen et al., 2013). A linked list is a structure whose elements storage is

not contagious memory locations. The operators for stacks are usually named differently. They

include Empty Stack that is the empty stack; it accepts an element and pushes it on top of the

available stack, while the selectors are top, which returns the part that's on top of a stack, and

pop, which produces the stack lacking the topmost aspect.

b. Reflection on the content


Data Structure 3

A real-life example of a stack is when you remove a plate from the pile of scales, and you pick

the scale on the top of the pile. But the plate you picked is precisely the plate added or inserted

most recently into the pile.

c. Outcome

The significant idea learned was how and various ways stacks can be actualized. PUSH's

down-to-earth way doesn't change the first stack; however, it creates a new stack from the

current stack and other components. It means that two stacks are the first and recently made to be

in any event.

WEEK TWO

a. Theoretical discussion

Queues were the main topic of discussion for the week as an advancement of

understanding on stacks. They are structures for information used to show a First in First Out

(FIFO) (Najm, Yates, & Soljanin, 2017). A line can be addressed graphically like elite or stack

yet with two different cells. The principal component highlights the rundown of features before

the rundown of components accessible in the line. Conversely, the subsequent component shows

the last component of the rundown. The queue is a direct information structure used to address a

straight rundown. It permits the addition component done toward one side and erasure of a

component to be performed at the opposite end.

The selectors are comparable for the stack, and they are best in class, which results in the

top segment of a line and fly in a line, which gives the line without the part on top.

As the queueing frameworks have gotten unpredictable over the long run, PGF (Probability

Generating Function) is quite possibly the most integral asset for giving the arrangement of the
Data Structure 4

set of differential equations and tackle problems involving probability. With the assistance of

PGF, we can, without much of a stretch, convert the discrete grouping of numbers, that is,

probabilities, into functions.

b. Reflection on the content

An excellent example of a queue is waiting in a supermarket check-out line. It means the

first person on the line will be the first person to be served and leave. This also applies to shared

resources when requests are being served, like printers.

c. outcome

Establishing a sound queue management system majorly helps automate the queuing

process, thus improving services and enhancing safety. The topic aid in the understanding of

LIPO and FIFO structures taught in week one.

WEEK THREE

a. theoretical discussion

the topic for the week was Analysis of Algorithms. It is a way of determining the number

of resources such as time and Space needed or required to execute it (Bach, Mihaljevic & Zagar,

2018). There are different types of analyses. They include the worst case, which the maximum

steps number, the Best case, the action number is taken is minimum, the Average case, an

average number of steps taken and Amortized, the steps of actions applied to the input. One of

the scientific methods applied to the analysis of algorithms is an empirical analysis which can

present an interpretation of information through an approach proving evidence.

b. Reflection on the content


Data Structure 5

The Brute-force algorithms use trial and error approaches to try out various

combinations. Brute force is based on two-techniques; Selection sort and Bubble sort:

c. Outcome

As a result, you need to put in mind time just as space complexity to solve a

problem as the program may execute on a framework where memory is restricted. However,

sufficient memory is accessible or the other way when comparing bubble sort and mergeSort.

Bubble sort do not require extra memory, while merge sort needs extra Space.

WEEK FOUR

a. theoretical discussion

Elementary Sorts was the topic for discussion. Sorting usually refers to the process of

putting items in a set into something well-understood and the order defined (Sedgewick &

Wayne, 2011). To sort, you need to recognize the thought of request on the things you are

thinking about. Elementary sorts are simple sorting algorithms. Thus, they are usually not

recommended for use on vast sets of data. They are handy for small data sets because of their

simplicity. Many sorting strategies are being used, and selection sorting and insertion sorting are

examples. In determination arranging, the littlest thing is found and put in the first position. At

that point, it finds the littlest of the things that remained and places it in the second position.

For example, when you need to sort an array that is randomly ordered with distinct keys by

insertion sort, it will use 1/4N^2 for comparison and average exchanging. If the array is in the

sequence that is ascending, inserting sort will make N – 1 compare and 0 exchange.

b. Reflection on the content

Of course, arranging is fundamental since masterminding the things in a requested

manner makes it simpler to find a specific thing, for example, finding the thing that is modest on
Data Structure 6

the rundown or the evaluations compared to a specific understudy. For instance, it is difficult to

look for a telephone contact when the all rundown isn't showing up in some known legitimate.

c. outcome

Therefore, I have comprehended that by arranging the information things to be put away

in an arranged cluster or twofold inquiry tree, the most pessimistic scenario that is the typical

intricacy of looking for a specific thing can be diminished.

WEEK FIVE

a. theoretical discussion

Merge ensures that identical elements are the same in the input and output (Sedgewick &

Wayne, 2011). Its algorithms that divide and conquer instead partition the problem of sorting

into small, more manageable problems. It means that it is more comfortable and efficient to sort

many smaller collections. This algorithm is implemented in different ways: a bottom-up

implementation that uses lists, a top-down implementation that uses list, bottom-up, and top-

down implementations.

Without a doubt, the guideline of converging of the two arranged assortments, that is,

they might be Records and arrays, or something fundamental. Since they are arranged, it is open

that the littlest thing is either the littlest thing in the primary assortment or the littlest.

b. Reflection on the content

For instance, the thing in the subsequent assortment is given top-notch. First, you should

isolate the rundown into the littlest unit; at that point, you contrast every component and the

adjoining rundown to sort and union the two contiguous records. Lastly, all the things will be

arranged and consolidated.

c. Outcome
Data Structure 7

Therefore, utilization of exhibits to the consolidation calculation needs to make

another exhibit that will store results for activities incidentally. Merge is valuable for arranging

connected records in O (N log N) time. For the situation of connected records, the case is

distinctive fundamentally because of the distinction in memory assignment.

WEEK SIX

a. Theoretical discussion

In quicksort, the main idea behind it is to repeat dividing or partition the array given to

ensure all the things in the main sub-cluster are more modest than all the things in the subsequent

sub-exhibit (Bramas, 2017). The critical thing with quicksort is how to partition; for example, If

the array is just a simple one, [5,4,8,9,2,7]. However, the best split is to put all the items that are

small than six into one part, resulting [5,4,2], and to place all, the items more oversized than or

equal to 6 into the other, making (8,9,7]. It is the standard Quicksort system. Furthermore, the

worth that characterizes the split is known as the rotate.

Quick sort can be examined by utilising normal case investigation whereby the normal number

of analyzes CN to quicksort a variety of N unmistakable keys =2N ln N (and the quantity of

trades is =⅓ N ln N.

b. Reflection on the content

A good example, you can check items that are chosen randomly and decide to pick the

one in the middle, called the median. Most of the time, quicksort is rarely the best algorithm to

use for a problem that is not large.

c. Outcome

Indeed, one of the circumstances that we need to try not to is segment the cluster into a

sub-exhibit unfilled and afterwards the entire exhibit once more. In case the present possibility
Data Structure 8

emerges, the calculation won't merely perform ineffectively. Yet, it won't execute. Therefore,

improving quicksort, the pivot will be best chosen when more items are sampled before.

WEEK SEVEN.

a. Theoretical discussion

Heapsort, termed another way, doesn't change the first stack yet makes another stack out

of the first stack and another component (Marszałek, 2017). A significant and essential part of

heapsort is that if merely the most excellent m < n things ought to be found and subsequently

masterminded, rather than all n. hence the intricacy of the subsequent stage is just O (mlog2 n),

which can undoubtedly be not precisely O(n) and consequently bringing about the entire

calculation to only O (n).

Heapsort can be developed by utilising normal case examination whereby the normal number of

thinks about CN to quicksort a variety of N unmistakable keys ≤ 2 N ln N (and the quantity of

trades is ≤ N ln N).

b. Reflection on the content

The mathematical analysis of heapsort shows that pile development utilizes ≤ 2 N for

correlation and ≤ N for trades. For example, the standard and most pessimistic scenario time two

intricacy capacities generally give intricacies of the whole Heapsort calculation.

c. Outcome

Heapsort is, to some degree, slower than quicksort. Quicksort is normally quicker.

However, there is consistently the opportunity of most pessimistic scenario execution. Stores can

be used in organizing a display. In max-heaps, the main segment will reliably be at the root.

Burden Sort uses this property of stack to sort the display. Heapsort works so that first, you start

by constructing a heap, that is, by adjusting the array elements. Once the heap is created,
Data Structure 9

repeatedly remove the heap's root element by moving it to the end of the array and then storing

the heap structure with the remaining elements.

When heapsort is compared with quicksort, it is not stable as quicksort. Since quicksort is

a comparison sort, it can sort items of any type for which a total order is defined. Heapsort can

be used in masterminding a display. In max-heaps, the most surprising part will reliably be at the

root. Heapsort uses this property of stack to sort the display.

WEEK EIGHT

a. Theoretical discussion

Binary Search Trees were discussed in the week. These are kinds of parallel trees that can

give productive methods of putting away information that permits specific things when looked to

be found as fast as could be expected (Sedgewick & Wayne, 2011). According to the

accompanying, the procedure to play out a mission for a value v in an equal pursuit tree, t is. In

case it is empty, v doesn't occur int, and as such, the chase stops with fake. In v, something

different is comparable to the base of t, v occurs in t, and hence we quit bringing valid back. On

the other hand, v is franker than the root; by the importance of the term equal chase tree, it is

adequate to glance through the left sub-tree of t. Thus override t with its left sub-tree and

continue comparatively.

On the off chance that numerical examination is made and N particular keys are embedded into a

BST in arbitrary order, the anticipated number of thinks about for a pursuit/embed is ~ 2 ln

N.Reflection on the content.

If v is more necessary than the root, replace t with its right sub-tree and continue

comparably. If N indisputable keys are installed into a BST in the sporadic solicitation for the

twofold chase trees, the typical number of dissects for a request/implant is two ln N.
Data Structure 10

b. Outcome

As a result, it is essential to check whether a parallel tree is a double hunt tree; thus, a

calculation is expected. Be that as it may, the clearest or most evident estimate isn't generally the

most proficient.

WEEK TEN

a. Theoretical discussion

A hash table is a data structure that can map keys to values (Ashkiani, Farach-Colton &

Owens, 2018)—for example, assuming that you were given access and a method of arriving at

directly to the section for that key. There would not be the need to look by any means at that

point. You will go there. When executing hash codes, it is pivotal to stay away from crashes.

Assuming the keys liable to happen are not uniformly spread through the Space of every single

imaginable access. Specific consideration should be paid to picking the hash work h so that

impacts among them are less inclined to happen.

While inspecting straight testing under uniform hashing doubt, the norm # of tests in a

direct looking at the hash table of size M that contains N = a M keys

The harsh function is defined used in linear probing is defined by H(x)= (key+ F(i)) mod

table size where i=0,1,2,3…n.

b. Reflection on the content


Data Structure 11

For example, separate affixing is a plan where each hash table has a rundown to deal with

crashes. One of the advantages of separate chaining is that it is straightforward to implement, but

it is inefficient.

c. Outcome

As a result of collisions, linear probing can resolve collisions in hash tables. Therefore, it

is used to maintain a collection of key-value pairs and look up the value associated with a given

key.

WEEK 11

a. Theoretical discussion

The topic for the week String Sorts. Strings can be sorted by applying different methods

that include natural sorting and custom sorting (Sedgewick & Wayne, 2011). The key-index

count is a sorting method whose efficiency is very high when keys are of small integers. This

outcome in its application in various zones like arranging string by the main letter, negotiating

class program by choice, and arranging telephone numbers by zone codes.

LSD radix sort is a steady circulation sort like can sort that disperses values into cans

dependent on the worth digits. It plays out a stable tallying style introduced on the rundown for

every number, starting from the furthest right digit. When it comes to MSD radix sort, it is the

most suitable for sorting strings or fixed-length integer representation.

b. Reflection on the content

For example, with 3456, you could begin with the three most significant digits (MSD) or

six least significant digits (LSD). But MSD and LSD differ in their order of traversal and how

they handle their variable. MSD string sort disservices incorporate reserve wasteful, an excessive

amount of memory putting away tally, and a lot of overhead reinitializing


Data Structure 12

c. Outcome

Sure, the three-way radix quicksort calculation can sort various N (pointers to) strings in

the lexicographic request. It Uses ~ 2 N ln N characters and looks at regular for arbitrary lines.

As a result, this method is not difficult to implement, making the three-way string quicksort a

choice method for sorting columns.

In conclusion, data structures are an essential tool for computer science and the

professionals who use them in their daily activities. The good thing is that there are more

advantages available than disadvantages. It gives ways to manage extensive data like databases

and safe data storage. It will enable processing data to be more comfortable and allows the

Internet to access data anytime.


Data Structure 13

References

Ashkiani, S., Farach-Colton, M. and Owens, J.D., 2018, May. A dynamic hash table for

the GPU. In 2018 IEEE International Parallel and Distributed Processing

Symposium (IPDPS) (pp. 419-429). IEEE.

Bach, L.M., Mihaljevic, B. and Zagar, M., 2018, May. Comparative analysis of

blockchain consensus algorithms. In 2018 41st International Convention on

Information and Communication Technology, Electronics and Microelectronics

(MIPRO) (pp. 1545-1550). IEEE.

Bramas, B., 2017. A novel hybrid quicksort algorithm vectorized using avx-512 on intel

skylake. arXiv preprint arXiv:1704.08579.

Catchen, J., Hohenlohe, P.A., Bassham, S., Amores, A. and Cresko, W.A., 2013. Stacks:

an analysis toolset for population genomics. Molecular Ecology, 22(11), pp.3124-

3140.

Marszałek, Z., 2017. Performance test on triple heap sort algorithm. Technical

Sciences/University of Warmia and Mazury in Olsztyn.

Najm, E., Yates, R. and Soljanin, E., 2017, June. Status updates through M/G/1/1 queues

with HARQ. In 2017 IEEE International Symposium on Information Theory

(ISIT) (pp. 131-135). IEEE.

Sedgewick, R. and Wayne, K., 2011. Algorithms and data structures. Princeton

University, COS, 226.

You might also like