This document provides an overview of data structures and algorithms. It discusses topics like arrays, stacks, queues, sparse matrices, and analysis of algorithms. Key points include:
- Arrays allow storing elements in contiguous memory locations and accessing via indexes. Representations include one-dimensional, two-dimensional, and sparse arrays.
- Stacks follow LIFO while queues follow FIFO using operations like push, pop for stacks and enqueue, dequeue for queues.
- Sparse matrices store only non-zero elements to save space using representations like triplet format and linked lists.
- Algorithm analysis includes asymptotic analysis of time and space complexity using notations like Big O. Performance of common operations on data structures is also
Data Structure & aaplications_Module-1.pptxGIRISHKUMARBC1
This document provides information about the course "Data Structures and Applications". The course aims to explain fundamentals of data structures and their applications for programming. It will cover linear and non-linear data structures like stacks, queues, lists, trees and graphs. Students will learn sorting and searching algorithms and how to select suitable data structures for application development and problem solving.
This document provides an introduction to the CSE 326: Data Structures course. It discusses the following key points in 3 sentences or less:
The course will cover common data structures and algorithms, how to choose the appropriate data structure for different needs, and how to justify design decisions through formal reasoning. It aims to help students become better developers by understanding fundamental data structures and when to apply them. The document provides examples of stacks and queues to illustrate abstract data types, data structures, and their implementations in different programming languages.
This document provides an introduction to the CSE 326: Data Structures course. It discusses the following key points in 3 sentences or less:
The course will cover common data structures and algorithms, how to choose the appropriate data structure for different needs, and how to justify design decisions through formal reasoning. It aims to help students become better developers by understanding fundamental data structures and when to apply them. The document provides examples of stacks and queues to illustrate abstract data types, data structures, and their implementations in different programming languages.
This document provides an overview of a Data Structures course. The course will cover basic data structures and algorithms used in software development. Students will learn about common data structures like lists, stacks, and queues; analyze the runtime of algorithms; and practice implementing data structures. The goal is for students to understand which data structures are appropriate for different problems and be able to justify design decisions. Key concepts covered include abstract data types, asymptotic analysis to evaluate algorithms, and the tradeoffs involved in choosing different data structure implementations.
This document provides an introduction to data structures and algorithms. It defines key terms like data structure, abstract data type, and algorithm. It also covers different types of data structures like arrays, linked lists, stacks, and queues. Specifically, it discusses the List abstract data type and implementations of lists using arrays and linked lists. It provides examples of common list operations like insertion, deletion, searching, and printing when using arrays and linked lists to represent a list. The running time of these operations is discussed as well.
02._Object-Oriented_Programming_Concepts.pptYonas D. Ebren
This document discusses object-oriented programming concepts and provides an example of analyzing a software development process using object-oriented principles. It describes a typical 5-step software development process of analysis, design, implementation, testing, and maintenance. It then introduces object-oriented programming concepts like modeling a problem as a set of collaborating objects and components. As an example, it analyzes the classic game Tetris in terms of its objects like pieces and boards, their properties and capabilities.
This document discusses different data structures and their implementation. It describes linear data structures like arrays, linked lists, stacks and queues that store elements sequentially and non-linear structures like trees and graphs that store elements non-sequentially. It also discusses abstract data types, static and dynamic implementation of data structures, and built-in versus user defined data structures. Real life applications of different data structures are provided.
The document discusses arrays and linked lists as abstract data types (ADTs). It describes arrays as the simplest data structure, storing elements in sequential memory locations. Linked lists store elements using pointers, with each node containing data and a pointer to the next node. The document outlines common operations on arrays and linked lists like traversal, insertion, deletion, and searching. It also discusses different types of linked lists like singly linked, doubly linked, and circular linked lists.
The document discusses data structures and algorithms. It defines data structures and different types including primitive and non-primitive structures. It describes operations on data structures like traversing, searching, insertion and deletion. It also defines concepts like abstract data types, asymptotic analysis, and different algorithm analysis methods. Examples provided include linear search algorithm and binary search algorithm in pseudocode and C code.
This document provides an introduction to the concept of data structures. It discusses the need for data structures due to increasing data and processing requirements. It defines key terms like abstract data type, algorithm complexity, and different types of data structures. It explains linear data structures like arrays, linked lists, stacks and queues. Non-linear structures like trees and graphs are also introduced. Common operations on data structures like traversing, insertion, deletion, searching and sorting are outlined. The document aims to provide foundational knowledge on data structures and algorithms.
- Exploratory data analysis (EDA) is used to summarize and visualize data to understand its key characteristics, variables, and relationships.
- In R, EDA involves descriptive statistics like mean, median, and mode as well as graphical methods like histograms, density plots, and box plots.
- Functions like head(), tail(), summary(), and str() provide information about the structure, dimensions, and descriptive statistics of data frames in R. Additional functions like pairs plots and faceted histograms allow visualizing relationships between variables.
The document discusses different data structures like arrays, linked lists, stacks, and queues, explaining what they are, common operations on them like searching and sorting, as well as examples of algorithms for implementing common operations like insertion and deletion on each data structure. Key data structures are explained along with their properties and typical applications.
This document provides an introduction to data structures and linear data structures. It discusses what data and data structures are, why we need data structures, and common operations on data structures like traversal, search, insertion, and deletion. It then covers specific linear data structures like arrays, linked lists, stacks, and queues. For each, it provides class definitions and examples of implementation and common operations like insertion, deletion, traversal, etc. It also discusses some applications of different data structures.
The document discusses different data structures like arrays, stacks, queues, linked lists, trees, graphs. It provides definitions of each data structure and describes their common operations like traversing, searching, insertion, deletion. It also includes algorithms for operations on linear arrays, stacks, queues and priority queues. Implementation of different data structures and their applications are explained with examples.
This document provides an introduction to data structures. It discusses primitive and non-primitive data structures and their classifications. Linear data structures like arrays, stacks, queues and linked lists are covered, along with non-linear structures like trees and graphs. Common operations on data structures like traversing, searching, inserting and deleting are also summarized. Finally, the document introduces abstract data types and provides examples of common ADT specifications for lists, stacks and queues.
This document provides an overview of advanced data structures and algorithms. It defines data structures as a way to store and organize data for efficient access and modification. The document then reviews basic concepts like variables, data types, and algorithms. It describes common data structures like arrays, linked lists, stacks, queues, trees, and hash tables. It also covers topics like asymptotic analysis, algorithms analysis, and the substitution method for solving algorithm recurrences. The document is an introduction to advanced data structure and algorithm concepts.
This document provides an overview of data structures and algorithms. It discusses pseudo code, abstract data types, atomic and composite data, data structures, algorithm efficiency using Big O notation, and various searching algorithms like sequential, binary, and hashed list searches. Key concepts covered include pseudo code structure and syntax, defining algorithms with headers and conditions, and analyzing different search algorithms.
The document discusses various Python libraries used for data science tasks. It describes NumPy for numerical computing, SciPy for algorithms, Pandas for data structures and analysis, Scikit-Learn for machine learning, Matplotlib for visualization, and Seaborn which builds on Matplotlib. It also provides examples of loading data frames in Pandas, exploring and manipulating data, grouping and aggregating data, filtering, sorting, and handling missing values.
1.1 introduction to Data Structures.pptAshok280385
Here are the algorithms for the given problems:
1. WAA to find largest of three numbers:
1. Start
2. Read three numbers a, b, c
3. If a > b and a > c then largest number is a
4. Else If b > a and b > c then largest number is b
5. Else largest number is c
6. Print largest number
7. Stop
2. WAA to find the sum of first 10 natural numbers using for loop:
1. Start
2. Declare variables i, sum
3. Initialize i=1, sum=0
4. For i=1 to 10
5. sum =
Different pricelists for different shops in odoo Point of Sale in Odoo 17Celine George
Price lists are a useful tool for managing the costs of your goods and services. This can assist you in working with other businesses effectively and maximizing your revenues. Additionally, you can provide your customers discounts by using price lists.
This document provides an introduction to data structures and algorithms. It defines key terms like data structure, abstract data type, and algorithm. It also covers different types of data structures like arrays, linked lists, stacks, and queues. Specifically, it discusses the List abstract data type and implementations of lists using arrays and linked lists. It provides examples of common list operations like insertion, deletion, searching, and printing when using arrays and linked lists to represent a list. The running time of these operations is discussed as well.
02._Object-Oriented_Programming_Concepts.pptYonas D. Ebren
This document discusses object-oriented programming concepts and provides an example of analyzing a software development process using object-oriented principles. It describes a typical 5-step software development process of analysis, design, implementation, testing, and maintenance. It then introduces object-oriented programming concepts like modeling a problem as a set of collaborating objects and components. As an example, it analyzes the classic game Tetris in terms of its objects like pieces and boards, their properties and capabilities.
This document discusses different data structures and their implementation. It describes linear data structures like arrays, linked lists, stacks and queues that store elements sequentially and non-linear structures like trees and graphs that store elements non-sequentially. It also discusses abstract data types, static and dynamic implementation of data structures, and built-in versus user defined data structures. Real life applications of different data structures are provided.
The document discusses arrays and linked lists as abstract data types (ADTs). It describes arrays as the simplest data structure, storing elements in sequential memory locations. Linked lists store elements using pointers, with each node containing data and a pointer to the next node. The document outlines common operations on arrays and linked lists like traversal, insertion, deletion, and searching. It also discusses different types of linked lists like singly linked, doubly linked, and circular linked lists.
The document discusses data structures and algorithms. It defines data structures and different types including primitive and non-primitive structures. It describes operations on data structures like traversing, searching, insertion and deletion. It also defines concepts like abstract data types, asymptotic analysis, and different algorithm analysis methods. Examples provided include linear search algorithm and binary search algorithm in pseudocode and C code.
This document provides an introduction to the concept of data structures. It discusses the need for data structures due to increasing data and processing requirements. It defines key terms like abstract data type, algorithm complexity, and different types of data structures. It explains linear data structures like arrays, linked lists, stacks and queues. Non-linear structures like trees and graphs are also introduced. Common operations on data structures like traversing, insertion, deletion, searching and sorting are outlined. The document aims to provide foundational knowledge on data structures and algorithms.
- Exploratory data analysis (EDA) is used to summarize and visualize data to understand its key characteristics, variables, and relationships.
- In R, EDA involves descriptive statistics like mean, median, and mode as well as graphical methods like histograms, density plots, and box plots.
- Functions like head(), tail(), summary(), and str() provide information about the structure, dimensions, and descriptive statistics of data frames in R. Additional functions like pairs plots and faceted histograms allow visualizing relationships between variables.
The document discusses different data structures like arrays, linked lists, stacks, and queues, explaining what they are, common operations on them like searching and sorting, as well as examples of algorithms for implementing common operations like insertion and deletion on each data structure. Key data structures are explained along with their properties and typical applications.
This document provides an introduction to data structures and linear data structures. It discusses what data and data structures are, why we need data structures, and common operations on data structures like traversal, search, insertion, and deletion. It then covers specific linear data structures like arrays, linked lists, stacks, and queues. For each, it provides class definitions and examples of implementation and common operations like insertion, deletion, traversal, etc. It also discusses some applications of different data structures.
The document discusses different data structures like arrays, stacks, queues, linked lists, trees, graphs. It provides definitions of each data structure and describes their common operations like traversing, searching, insertion, deletion. It also includes algorithms for operations on linear arrays, stacks, queues and priority queues. Implementation of different data structures and their applications are explained with examples.
This document provides an introduction to data structures. It discusses primitive and non-primitive data structures and their classifications. Linear data structures like arrays, stacks, queues and linked lists are covered, along with non-linear structures like trees and graphs. Common operations on data structures like traversing, searching, inserting and deleting are also summarized. Finally, the document introduces abstract data types and provides examples of common ADT specifications for lists, stacks and queues.
This document provides an overview of advanced data structures and algorithms. It defines data structures as a way to store and organize data for efficient access and modification. The document then reviews basic concepts like variables, data types, and algorithms. It describes common data structures like arrays, linked lists, stacks, queues, trees, and hash tables. It also covers topics like asymptotic analysis, algorithms analysis, and the substitution method for solving algorithm recurrences. The document is an introduction to advanced data structure and algorithm concepts.
This document provides an overview of data structures and algorithms. It discusses pseudo code, abstract data types, atomic and composite data, data structures, algorithm efficiency using Big O notation, and various searching algorithms like sequential, binary, and hashed list searches. Key concepts covered include pseudo code structure and syntax, defining algorithms with headers and conditions, and analyzing different search algorithms.
The document discusses various Python libraries used for data science tasks. It describes NumPy for numerical computing, SciPy for algorithms, Pandas for data structures and analysis, Scikit-Learn for machine learning, Matplotlib for visualization, and Seaborn which builds on Matplotlib. It also provides examples of loading data frames in Pandas, exploring and manipulating data, grouping and aggregating data, filtering, sorting, and handling missing values.
1.1 introduction to Data Structures.pptAshok280385
Here are the algorithms for the given problems:
1. WAA to find largest of three numbers:
1. Start
2. Read three numbers a, b, c
3. If a > b and a > c then largest number is a
4. Else If b > a and b > c then largest number is b
5. Else largest number is c
6. Print largest number
7. Stop
2. WAA to find the sum of first 10 natural numbers using for loop:
1. Start
2. Declare variables i, sum
3. Initialize i=1, sum=0
4. For i=1 to 10
5. sum =
Different pricelists for different shops in odoo Point of Sale in Odoo 17Celine George
Price lists are a useful tool for managing the costs of your goods and services. This can assist you in working with other businesses effectively and maximizing your revenues. Additionally, you can provide your customers discounts by using price lists.
RE-LIVE THE EUPHORIA!!!!
The Quiz club of PSGCAS brings to you a fun-filled breezy general quiz set from numismatics to sports to pop culture.
Re-live the Euphoria!!!
QM: Eiraiezhil R K,
BA Economics (2022-25),
The Quiz club of PSGCAS
Completed Sunday 6/8. For Weekend 6/14 & 15th. (Fathers Day Weekend US.) These workshops are also timeless for future students TY. No admissions needed.
A 9th FREE WORKSHOP
Reiki - Yoga
“Intuition-II, The Chakras”
Your Attendance is valued.
We hit over 5k views for Spring Workshops and Updates-TY.
Thank you for attending our workshops.
If you are new, do welcome.
Grad Students: I am planning a Reiki-Yoga Master Course (As a package). I’m Fusing both together.
This will include the foundation of each practice. Our Free Workshops can be used with any Reiki Yoga training package. Traditional Reiki does host rules and ethics. Its silent and within the JP Culture/Area/Training/Word of Mouth. It allows remote healing but there’s limits As practitioners and masters, we are not allowed to share certain secrets/tools. Some content is designed only for “Masters”. Some yoga are similar like the Kriya Yoga-Church (Vowed Lessons). We will review both Reiki and Yoga (Master tools) in the Course upcoming.
S9/This Week’s Focus:
* A continuation of Intuition-2 Development. We will review the Chakra System - Our temple. A misguided, misused situation lol. This will also serve Attunement later.
Thx for tuning in. Your time investment is valued. I do select topics related to our timeline and community. For those seeking upgrades or Reiki Levels. Stay tuned for our June packages. It’s for self employed/Practitioners/Coaches…
Review & Topics:
* Reiki Is Japanese Energy Healing used Globally.
* Yoga is over 5k years old from India. It hosts many styles, teacher versions, and it’s Mainstream now vs decades ago.
* Anything of the Holistic, Wellness Department can be fused together. My origins are Alternative, Complementary Medicine. In short, I call this ND. I am also a metaphysician. I learnt during the 90s New Age Era. I forget we just hit another wavy. It’s GenZ word of Mouth, their New Age Era. WHOA, History Repeats lol. We are fusing together.
* So, most of you have experienced your Spiritual Awakening. However; The journey wont be perfect. There will be some roller coaster events. The perks are: We are in a faster Spiritual Zone than the 90s. There’s more support and information available.
(See Presentation for all sections, THX AGAIN.)
Analysis of Quantitative Data Parametric and non-parametric tests.pptxShrutidhara2
This presentation covers the following points--
Parametric Tests
• Testing the Significance of the Difference between Means
• Analysis of Variance (ANOVA) - One way and Two way
• Analysis of Co-variance (One-way)
Non-Parametric Tests:
• Chi-Square test
• Sign test
• Median test
• Sum of Rank test
• Mann-Whitney U-test
Moreover, it includes a comparison of parametric and non-parametric tests, a comparison of one-way ANOVA, two-way ANOVA, and one-way ANCOVA.
*Order Hemiptera:*
Hemiptera, commonly known as true bugs, is a large and diverse order of insects that includes cicadas, aphids, leafhoppers, and shield bugs. Characterized by their piercing-sucking mouthparts, Hemiptera feed on plant sap, other insects, or small animals. Many species are significant pests, while others are beneficial predators.
*Order Neuroptera:*
Neuroptera, also known as net-winged insects, is an order of insects that includes lacewings, antlions, and owlflies. Characterized by their delicate, net-like wing venation and large, often prominent eyes, Neuroptera are predators that feed on other insects, playing an important role in biological control. Many species have aquatic larvae, adding to their ecological diversity.
How to Create an Event in Odoo 18 - Odoo 18 SlidesCeline George
Creating an event in Odoo 18 is a straightforward process that allows you to manage various aspects of your event efficiently.
Odoo 18 Events Module is a powerful tool for organizing and managing events of all sizes, from conferences and workshops to webinars and meetups.
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...parmarjuli1412
The document provides an overview of therapeutic communication, emphasizing its importance in nursing to address patient needs and establish effective relationships. THERAPEUTIC COMMUNICATION included some topics like introduction of COMMUNICATION, definition, types, process of communication, definition therapeutic communication, goal, techniques of therapeutic communication, non-therapeutic communication, few ways to improved therapeutic communication, characteristics of therapeutic communication, barrier of THERAPEUTIC RELATIONSHIP, introduction of interpersonal relationship, types of IPR, elements/ dynamics of IPR, introduction of therapeutic nurse patient relationship, definition, purpose, elements/characteristics , and phases of therapeutic communication, definition of Johari window, uses, what actually model represent and its areas, THERAPEUTIC IMPASSES and its management in 5th semester Bsc. nursing and 2nd GNM students
Pests of Rice: Damage, Identification, Life history, and Management.pptxArshad Shaikh
Rice pests can significantly impact crop yield and quality. Major pests include the brown plant hopper (Nilaparvata lugens), which transmits viruses like rice ragged stunt and grassy stunt; the yellow stem borer (Scirpophaga incertulas), whose larvae bore into stems causing deadhearts and whiteheads; and leaf folders (Cnaphalocrocis medinalis), which feed on leaves reducing photosynthetic area. Other pests include rice weevils (Sitophilus oryzae) and gall midges (Orseolia oryzae). Effective management strategies are crucial to minimize losses.
Parenting Teens: Supporting Trust, resilience and independencePooky Knightsmith
For more information about my speaking and training work, visit: https://www.pookyknightsmith.com/speaking/
SESSION OVERVIEW:
Parenting Teens: Supporting Trust, Resilience & Independence
The teenage years bring new challenges—for teens and for you. In this practical session, we’ll explore how to support your teen through emotional ups and downs, growing independence, and the pressures of school and social life.
You’ll gain insights into the teenage brain and why boundary-pushing is part of healthy development, along with tools to keep communication open, build trust, and support emotional resilience. Expect honest ideas, relatable examples, and space to connect with other parents.
By the end of this session, you will:
• Understand how teenage brain development affects behaviour and emotions
• Learn ways to keep communication open and supportive
• Explore tools to help your teen manage stress and bounce back from setbacks
• Reflect on how to encourage independence while staying connected
• Discover simple strategies to support emotional wellbeing
• Share experiences and ideas with other parents
Ray Dalio How Countries go Broke the Big CycleDadang Solihin
A complete and practical understanding of the Big Debt Cycle. A much more practical understanding of how supply and demand really work compared to the conventional economic thinking. A complete and practical understanding of the Overall Big Cycle, which is driven by the Big Debt Cycle and the other major cycles, including the big political cycle within countries that changes political orders and the big geopolitical cycle that changes world orders.
Human Anatomy and Physiology II Unit 3 B pharm Sem 2
Respiratory system
Anatomy of respiratory system with special reference to anatomy
of lungs, mechanism of respiration, regulation of respiration
Lung Volumes and capacities transport of respiratory gases,
artificial respiration, and resuscitation methods
Urinary system
Anatomy of urinary tract with special reference to anatomy of
kidney and nephrons, functions of kidney and urinary tract,
physiology of urine formation, micturition reflex and role of
kidneys in acid base balance, role of RAS in kidney and
disorders of kidney
How to Create a Rainbow Man Effect in Odoo 18Celine George
In Odoo 18, the Rainbow Man animation adds a playful and motivating touch to task completion. This cheerful effect appears after specific user actions, like marking a CRM opportunity as won. It’s designed to enhance user experience by making routine tasks more engaging.
Artificial intelligence Presented by JM.jmansha170
AI (Artificial Intelligence) :
"AI is the ability of machines to mimic human intelligence, such as learning, decision-making, and problem-solving."
Important Points about AI:
1. Learning – AI can learn from data (Machine Learning).
2. Automation – It helps automate repetitive tasks.
3. Decision Making – AI can analyze and make decisions faster than humans.
4. Natural Language Processing (NLP) – AI can understand and generate human language.
5. Vision & Recognition – AI can recognize images, faces, and patterns.
6. Used In – Healthcare, finance, robotics, education, and more.
Owner By:
Name : Junaid Mansha
Work : Web Developer and Graphics Designer
Contact us : +92 322 2291672
Email : [email protected]
2. Agenda
• Introduction to Data Structures.
• ADT vs. DS.
• Python Built-in Data Structures (Lists, Tuples, Sets, Dict).
• Famous Data Structures:
Stack.
Queue.
Linked Lists && Doubly Linked Lists.
4. Dictionaries (I)
• Store pairs of entries called items
{ 'CS' : '743-713-3350', 'UHPD' : '713-743-3333'}
• Each pair of entries contains
• A key
• A value
• Key and values are separated by a colon
• Paris of entries are separated by commas
• Dictionary is enclosed within curly braces
5. Usage
• Keys must be unique within a dictionary
• No duplicates
• If we have
age = {'Alice' : 25, 'Bob' :28}
then
age['Alice'] is 25 #is used for checking the value
and
age['Bob'] is 28
6. Dictionaries are mutable
• >>> age = {'Alice' : 25, 'Bob' : 28}
• >>> saved = age
• >>> age['Bob'] = 29
• >>> age
{'Bob': 29, 'Alice': 25}
• >>> saved
{'Bob': 29, 'Alice': 25}
7. Keys must be unique
• >>> age = {'Alice' : 25, 'Bob' : 28, 'Alice' : 26}
• >>> age
{'Bob': 28, 'Alice': 26} # if two value for the same key the
last one is
the one that will be saved
9. Updating directories
• >>> age = {'Alice': 26 , 'Carol' : 22}
The update function either update existing value or create it if no
exist
• >>> age.update({'Bob' : 29})
• >>> age
{'Bob': 29, 'Carol': 22, 'Alice': 26}
• >>> age.update({'Carol' : 23})
• >>> age
{'Bob': 29, 'Carol': 23, 'Alice': 26}
10. Returning a value
• >>> age = {'Bob': 29, 'Carol': 23, 'Alice': 26}
• >>> age.get('Bob')
29
• >>> age['Bob']
29
11. Removing a specific item (I)
• >>> a = {'Alice' : 26, 'Carol' : 'twenty-two'}
• >>> a
{'Carol': 'twenty-two', 'Alice': 26}
• # pop function take the key remove the key and value from the dictionary and return the
value
• >>> a.pop('Carol’)
'twenty-two'
• >>> a
{'Alice': 26}
13. Remove the first item
# popitem() it will select the first item in the dictionary to return and remove it
• >>> age = {'Bob': 29, 'Carol': 23, 'Alice': 26}
• >>> age.popitem()
• ('Bob', 29)
• >>> age
• {'Carol': 23, 'Alice': 26}
• >>> age.popitem()
('Carol', 23)
• >>> age
{'Alice': 26}
14. 14
Data Types & Data Structures
• Applications/programs read data, store data temporarily,
process it and finally output results.
• What is data? Numbers, Characters, etc.
Application/
Program
Input
data
Output
data
16. 16
The Need for Data Structures
• Data structures organize data
more efficient programs.
• More powerful computers more complex applications.
• More complex applications demand more calculations.
• Complex computing tasks are unlike our everyday experience.
• Any organization for a collection of records can be searched,
processed in any order, or modified.
• The choice of data structure and algorithm can make the difference
between a program running in a few seconds or many days.
17. 17
Efficiency
A solution is said to be efficient if it solves the problem within its
resource constraints.
• Space
• Time
• The cost of a solution is the amount of resources that the
solution consumes… expressed in terms of big O notation
18. 18
Selecting a Data Structure
Select a data structure as follows:
1. Analyze the problem to determine the resource
constraints a solution must meet.
2. Determine the basic operations that must be supported.
Quantify the resource constraints for each operation.
3. Select the data structure that best meets these
requirements.
19. 19
Abstract Data Types
Abstract Data Type (ADT): a definition for a data type solely in
terms of a set of values and a set of operations on that data
type.
Each ADT operation is defined by its inputs and outputs.
Encapsulation: Hide implementation details.
20. 20
Data Structure
• A data structure is the physical implementation of an ADT.
• Each operation associated with the ADT is implemented by one or more subroutines in
the implementation.
• Data structure usually refers to an organization for data in main memory.
• File structure is an organization for data on peripheral storage, such as a disk
drive.
• Data structure is representation of the logical relationship existing between
individual elements of data.
• In other words, a data structure is a way of organizing all data items that
considers not only the elements stored but also their relationship to each other.
21. 21
Logical vs. Physical Form
Data items have both a logical and a physical form.
Logical form: definition of the data item within an ADT.
• Ex: Integers in mathematical sense: +, -
Physical form: implementation of the data item within a data
structure.
• Ex: 16/32 bit integers, overflow.
22. What is Program
• Data structure affects the design of both structural & functional aspects of a program.
Program=algorithm + Data Structure
• You know that a algorithm is a step by step procedure to solve a particular function.
• A Set of Instructions
• Data Structures + Algorithms
• Data Structure = A Container stores Data
• Algorithm = Logic + Control
• That means, algorithm is a set of instruction written to carry out certain tasks & the
data structure is the way of organizing the data with their logical relationship retained.
• To develop a program of an algorithm, we should select an appropriate data structure
for that algorithm.
• Therefore algorithm and its associated data structures from a program.
23. Functions of Data Structures
• The most commonly used operation on data
structure are broadly categorized into following
types:
• Create.
• Insert
• Delete
• update
Some DS need extra functions
• Selection.
• Searching.
• Sorting.
• Merging.
Insertion needs sometime
• Index.
• Key.
• Position.
• Priority.
24. Common Data Structures
• List
• Set
• Tuple
• Dictionary
• Stack
• Queue
• Linked List
• Tree
• Heap
• Hash Table
• Priority Queue
this lecture
through next lectures
https://www.youtube.com/watch?v=R-HLU9Fl5ug
Video tutorial: (in Python)
https://www.programiz.com/python-programming/list
Interactive tutorial: (in Python)
https://www.programiz.com/python-programming/set
https://www.programiz.com/python-programming/tuple
https://www.programiz.com/python-programming/dictionary
26. 26
The Stack ADT
• The Stack ADT stores arbitrary
objects
• Insertions and deletions follow
the last-in first-out scheme
• Think of a spring-loaded plate
dispenser
• Main stack operations:
• push(object): inserts an element
• object pop(): removes and returns
the last inserted element
• Auxiliary stack operations:
• object top(): returns the last
inserted element without
removing it
• integer len(): returns the
number of elements stored
• boolean is_empty(): indicates
whether no elements are stored
28. Applications of Stacks
• Direct applications
• Page-visited history in a Web browser
• Undo sequence in a text editor
• Chain of method calls in a language that supports recursion
• Indirect applications
• Auxiliary data structure for algorithms
• Component of other data structures
29. List-based Stack
• A simple way of implementing the Stack ADT uses a list
• We add elements from left to right
• A variable keeps track of the index of the top element
S
0 1 2 t
…
33. The Queue ADT
• The Queue ADT stores arbitrary
objects
• Insertions and deletions follow
the first-in first-out scheme
• Insertions are at the rear of the
queue and removals are at the
front of the queue
• Main queue operations:
• enqueue(object): inserts an
element at the end of the queue
• object dequeue(): removes and
returns the element at the
front of the queue
• Auxiliary queue
operations:
• object first(): returns the
element at the front
without removing it
• integer len(): returns the
number of elements stored
• boolean is_empty():
indicates whether no
elements are stored
35. Applications of Queues
• Direct applications
• Waiting lists, bureaucracy
• Access to shared resources (e.g., printer)
• Multiprogramming
• Indirect applications
• Auxiliary data structure for algorithms
• Component of other data structures
36. Queue in Python
• Use the following three instance variables:
• _data: is a reference to a list instance with a fixed capacity.
• _size: is an integer representing the current number of elements
stored in the queue (as opposed to the length of the data list).
• _front: is an integer that represents the index within data of the
first element of the queue (assuming the queue is not empty).
39. Linked List Data Structure
Visualize the Queue:
https://visualgo.net/en/list
40. Singly Linked List
A singly linked list is a
concrete data structure
consisting of a sequence of
nodes, starting from a head
pointer
Each node stores
element
link to the next node
next
elem node
A B C D
head
41. Inserting at the Head
1. Allocate a new node
2. Insert new element
3. Have new node point to old
head
4. Update head to point to new
node
42. Removing at the Head
1. Update head to point
to next node in the
list
2. Allow garbage
collector to reclaim
the former first node
43. Inserting at the Tail
1. Allocate a new node
2. Insert new element
3. Have new node
point to null
4. Have old last node
point to new node
5. Update tail to point
to new node
44. Removing at the Tail
Removing at the tail
of a singly linked list
is not efficient!
There is no
constant-time way
to update the tail to
point to the previous
node
45. Linked Lists
Stack as a Linked List
We can implement a stack with a singly linked list
The top element is stored at the first node of the list
The space used is O(n) and each operation of the Stack ADT
takes O(1) time
t
nodes
elements
47. Linked Lists
Queue as a Linked List
We can implement a queue with a singly linked list
The front element is stored at the first node
The rear element is stored at the last node
The space used is O(n) and each operation of the Queue ADT
takes O(1) time
f
r
nodes
elements
50. Doubly-Linked Lists
Doubly Linked List
• A doubly linked list provides a natural
implementation of the Node List ADT
• Nodes implement Position and store:
• element
• link to the previous node
• link to the next node
• Special trailer and header nodes
prev next
elem
trailer
header nodes/positions
elements
node
Visualize the Doubly linked List:
https://visualgo.net/en/list
51. Insertion
• Insert a new node, q, between p and its successor.
A B X C
A B C
p
A B C
p
X
q
p q
52. Deletion
• Remove a node, p, from a doubly-linked list.
A B C D
p
A B C
D
p
A B C
#16: A primary concern for this course is efficiency.
You might believe that faster computers make it unnecessary to be concerned with efficiency. However…
So we need special training.
#17: Alternate definition: Better than known alternatives (“relatively efficient”).
Space and time are typical constraints for programs.
This does not mean always strive for the most efficient program. If the program operates well within resource constraints, there is no benefit to making it faster or smaller.
#18: Typically want the “simplest” data structure that will meet the requirements.
#46: slot is nothing more than a memory management nicety: when you define __slots__ on a class, you’re telling the Python interpreter that the list of attributes described within are the only attributes this class will ever need, and a dynamic dictionary is not needed to manage the references to other objects within the class