100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Test Bank for Secure Data Structures and Algorithms with C++ Walls and Mirrors, 18th Edition by Carrano

Rating
-
Sold
-
Pages
168
Grade
A+
Uploaded on
12-02-2025
Written in
2024/2025

Test Bank for Secure Data Structures and Algorithms with C++ Walls and Mirrors, 18th Edition by Carrano

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Course

Document information

Uploaded on
February 12, 2025
Number of pages
168
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Lecture Notes for
g g




Data Structures and Algorithms
g g g




Revisedg eachg yearg byg Johng Bullinaria

SchoolgofgComputergSciencegUniversit
ygofgBirminghamgBirmingham,gUK




Versiong ofg 27g Marchg 2019

,ThesegnotesgaregcurrentlygrevisedgeachgyeargbygJohngBullinaria.g Theygincludegsectionsgbasedgong
notesgoriginallygwrittengbygMart´ıngEscardó gandgrevisedgbygManfredgKerber.g Allgaregmembersgo
fg theg Schoolg ofg Computerg Science,g Universityg ofg Birmingham,g UK.


⃝cg Schoolg ofg Computerg Science,g Universityg ofg Birmingham,g UK,g 2018




1

,Contents

1 Introduction 5
1.1 Algorithmsg asg opposedg tog programs ..................................................................................5
1.2 Fundamentalg questionsg aboutg algorithms..........................................................................6
1.3 Datag structures,g abstractg datag types,g designg patterns.....................................................7
1.4 Textbooksg andg web-resources .............................................................................................7
1.5 Overview................................................................................................................................8

2 Arrays,g Iteration,g Invariants 9
2.1 Arrays................................................................................................................................... 9
2.2 Loopsg andg Iteration ............................................................................................................10
2.3 Invariants .............................................................................................................................10

3 Lists,g Recursion,g Stacks,g Queues 12
3.1 Linkedg Lists ....................................................................................................................... 12
3.2 Recursion .............................................................................................................................15
3.3 Stacks ...................................................................................................................................16
3.4 Queues.................................................................................................................................17
3.5 Doublyg Linkedg Lists .......................................................................................................... 18
3.6 Advantageg ofg Abstractg Datag Types ..................................................................................20

4 Searching 21
4.1 Requirementsg forg searching ...............................................................................................21
4.2 Specificationg ofg theg searchg problem .................................................................................22
4.3 Agsimplegalgorithm:g LineargSearch ................................................................................ 22
4.4 Ag moreg efficientg algorithm:g Binaryg Search .....................................................................23

5 Efficiencyg andg Complexity 25
5.1 Timeg versusg spaceg complexity ...........................................................................................25
5.2 Worstg versusg averageg complexity ......................................................................................25
5.3 Concreteg measuresg forg performance .................................................................................26
5.4 Big-Og notationg forg complexityg class ................................................................................26
5.5 Formalg definitiong ofg complexityg classes...........................................................................29

6 Trees 31
6.1 Generalg specificationg ofg trees ...........................................................................................31
6.2 Quad-trees...........................................................................................................................32
6.3 Binaryg trees ........................................................................................................................33


2

, 6.4 Primitiveg operationsg ong binaryg trees...............................................................................34
6.5 Theg heightg ofg ag binaryg tree ..............................................................................................36
6.6 Theg sizeg ofg ag binaryg tree ...................................................................................................37
6.7 Implementationg ofg trees ....................................................................................................37
6.8 Recursiveg algorithms ..........................................................................................................38

7 BinarygSearchgTrees 40
7.1 Searchingg withg arraysg org lists ...........................................................................................40
7.2 Searchg keys .........................................................................................................................40
7.3 Binaryg searchg trees ............................................................................................................41
7.4 Buildingg binaryg searchg trees.............................................................................................41
7.5 Searchingg ag binaryg searchg tree .........................................................................................42
7.6 Timeg complexityg ofg insertiong andg search ........................................................................43
7.7 Deletingg nodesg fromg ag binaryg searchg tree .......................................................................44
7.8 Checkingg whetherg ag binaryg treeg isg ag binaryg searchg tree................................................46
7.9 Sortingg usingg binaryg searchg trees.....................................................................................47
7.10 Balancingg binaryg searchg trees ..........................................................................................48
7.11 Self-balancinggAVLgtrees ................................................................................................ 48
7.12 B-trees .................................................................................................................................49

8 Priorityg Queuesg andg Heapg Trees 51
8.1 Treesg storedg ing arrays ........................................................................................................51
8.2 Priorityg queuesg andg binaryg heapg trees ............................................................................52
8.3 Basicg operationsg ong binaryg heapg trees ............................................................................53
8.4 Insertingg ag newg heapg treeg node ........................................................................................54
8.5 Deletingg ag heapg treeg node.................................................................................................55
8.6 Buildingg ag newg heapg treeg fromg scratch ............................................................................56
8.7 Mergingg binaryg heapg trees................................................................................................58
8.8 Binomialg heaps...................................................................................................................59
8.9 Fibonaccig heaps .................................................................................................................61
8.10 Comparisong ofg heapg timeg complexities ............................................................................62

9 Sorting 63
9.1 Theg problemg ofg sorting ......................................................................................................63
9.2 Commong sortingg strategies ............................................................................................... 64
9.3 Howg manyg comparisonsg mustg itg take? .............................................................................64
9.4 Bubbleg Sort .........................................................................................................................66
9.5 Insertiong Sort ......................................................................................................................67
9.6 Selectiong Sort ......................................................................................................................69
9.7 Comparisong ofg O(n2)g sortingg algorithms .........................................................................70
9.8 Sortingg algorithmg stability................................................................................................. 71
9.9 Treesort ...............................................................................................................................71
9.10 Heapsort ..............................................................................................................................72
9.11 Divideg andg conquerg algorithms .........................................................................................74
9.12 Quicksort .............................................................................................................................75
9.13 Mergesort ............................................................................................................................79
9.14 Summaryg ofg comparison-basedg sortingg algorithms .........................................................81


3

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
VISIONARYTESTBANKS Teachme2-tutor
Follow You need to be logged in order to follow users or courses
Sold
21
Member since
9 months
Number of followers
2
Documents
456
Last sold
1 month ago

4.8

717 reviews

5
631
4
42
3
25
2
10
1
9

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions