This document discusses various abstract data types (ADTs) including stacks, queues, priority queues, and deque. It provides code examples and explanations of how each ADT works, including common operations like push, pop, enqueue, dequeue. Specific applications are given like using stacks for reversing words or checking brackets in expressions. Implementation details are abstracted away and complexity analyses are provided for common operations.
Stack is a collection based on the principle of adding elements and retrieving them in the opposite order
What is STACK?
Stack Operations
Applications
Built-in Stack
Downloadable Resources
Queue is a collection whose elements are added at one end and removed from the other end
What is a Queue
Conceptual View of a Queue
Uses of Queues in Computing
Operations on a Queue
Implementation of a Queue
Applications
Downloadable Resources
Data Structures are the programmatic way of storing data so that data can be used efficiently
Introduction to DSA
Advantages & Disadvantages
Abstract Data Type (ADT)
Linear Array List
Downloadable Resources
Queue is an abstract data structure, somewhat similar to Stacks. Unlike stacks, a queue is open at both its ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). Queue follows First-In-First-Out methodology, i.e., the data item stored first will be accessed first.
Stacks and Queues: Introduction to stacks
applications of stacks
implementation and comparison of stack implementations.
Introduction to queues
applications of queues and implementations
Priority Queues and applications
A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order
What is sorting algorithm
The bubble sort
The selection sort
The insertion sort
The Quick sort
The Shell Sort
Queue is an abstract data structure, somewhat similar to Stacks. Unlike stacks, a queue is open at both its ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). Queue follows First-In-First-Out methodology, i.e., the data item stored first will be accessed first.
Stack is a collection based on the principle of adding elements and retrieving them in the opposite order
What is STACK?
Stack Operations
Applications
Built-in Stack
Downloadable Resources
Queue is a collection whose elements are added at one end and removed from the other end
What is a Queue
Conceptual View of a Queue
Uses of Queues in Computing
Operations on a Queue
Implementation of a Queue
Applications
Downloadable Resources
Data Structures are the programmatic way of storing data so that data can be used efficiently
Introduction to DSA
Advantages & Disadvantages
Abstract Data Type (ADT)
Linear Array List
Downloadable Resources
Queue is an abstract data structure, somewhat similar to Stacks. Unlike stacks, a queue is open at both its ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). Queue follows First-In-First-Out methodology, i.e., the data item stored first will be accessed first.
Stacks and Queues: Introduction to stacks
applications of stacks
implementation and comparison of stack implementations.
Introduction to queues
applications of queues and implementations
Priority Queues and applications
A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order
What is sorting algorithm
The bubble sort
The selection sort
The insertion sort
The Quick sort
The Shell Sort
Queue is an abstract data structure, somewhat similar to Stacks. Unlike stacks, a queue is open at both its ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). Queue follows First-In-First-Out methodology, i.e., the data item stored first will be accessed first.
This is an intermediate conversion course for C++, suitable for second year computing students who may have learned Java or another language in first year.
Data structure and algorithm using javaNarayan Sau
This presentation created for people who like to go back to basics of data structure and its implementation. This presentation mostly helps B.Tech , Bsc Computer science students as well as all programmer who wants to develop software in core areas.
In computer science, a queue (/ˈkjuː/ kyew) is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed. Often a peek or front operation is also entered, returning the value of the front element without dequeuing it. A queue is an example of a linear data structure, or more abstractly a sequential collection.
Opendatabay - Open Data Marketplace.pptxOpendatabay
Opendatabay.com unlocks the power of data for everyone. Open Data Marketplace fosters a collaborative hub for data enthusiasts to explore, share, and contribute to a vast collection of datasets.
First ever open hub for data enthusiasts to collaborate and innovate. A platform to explore, share, and contribute to a vast collection of datasets. Through robust quality control and innovative technologies like blockchain verification, opendatabay ensures the authenticity and reliability of datasets, empowering users to make data-driven decisions with confidence. Leverage cutting-edge AI technologies to enhance the data exploration, analysis, and discovery experience.
From intelligent search and recommendations to automated data productisation and quotation, Opendatabay AI-driven features streamline the data workflow. Finding the data you need shouldn't be a complex. Opendatabay simplifies the data acquisition process with an intuitive interface and robust search tools. Effortlessly explore, discover, and access the data you need, allowing you to focus on extracting valuable insights. Opendatabay breaks new ground with a dedicated, AI-generated, synthetic datasets.
Leverage these privacy-preserving datasets for training and testing AI models without compromising sensitive information. Opendatabay prioritizes transparency by providing detailed metadata, provenance information, and usage guidelines for each dataset, ensuring users have a comprehensive understanding of the data they're working with. By leveraging a powerful combination of distributed ledger technology and rigorous third-party audits Opendatabay ensures the authenticity and reliability of every dataset. Security is at the core of Opendatabay. Marketplace implements stringent security measures, including encryption, access controls, and regular vulnerability assessments, to safeguard your data and protect your privacy.
Adjusting primitives for graph : SHORT REPORT / NOTESSubhajit Sahu
Graph algorithms, like PageRank Compressed Sparse Row (CSR) is an adjacency-list based graph representation that is
Multiply with different modes (map)
1. Performance of sequential execution based vs OpenMP based vector multiply.
2. Comparing various launch configs for CUDA based vector multiply.
Sum with different storage types (reduce)
1. Performance of vector element sum using float vs bfloat16 as the storage type.
Sum with different modes (reduce)
1. Performance of sequential execution based vs OpenMP based vector element sum.
2. Performance of memcpy vs in-place based CUDA based vector element sum.
3. Comparing various launch configs for CUDA based vector element sum (memcpy).
4. Comparing various launch configs for CUDA based vector element sum (in-place).
Sum with in-place strategies of CUDA mode (reduce)
1. Comparing various launch configs for CUDA based vector element sum (in-place).
2. Abstract Data Type
• Abstract Data Type as a design tool
• Concerns only on the important concept or
model
• No concern on implementation details.
• Stack & Queue is an example of ADT
• An array is not ADT.
3. What is the
difference?
• Stack & Queue vs. Array
– Arrays are data storage structures while stacks and
queues are specialized DS and used as programmer’s
tools.
• Stack – a container that allows push and pop
• Queue - a container that allows enqueue and
dequeue
• No concern on implementation details.
• In an array any item can be accessed, while in
these data structures access is restricted.
• They are more abstract than arrays.
4. Questions?
• Array is not ADT
• Is Linked list ADT?
• Is Binary-tree ADT?
• Is Hash table ADT?
• What about graph?
5. Stacks
• Allows access to only the last item inserted.
• An item is inserted or removed from the stack
from one end called the “top” of the stack.
• This mechanism is called Last-In-First-Out
(LIFO).
A Stack Applet example
6. Stack operations
• Placing a data item on the top is called
“pushing”, while removing an item from the top is
called “popping” it.
• push and pop are the primary stack operations.
• Some of the applications are : microprocessors,
some older calculators etc.
7. Example of Stack codes
• First example stack ADT and implementation
C:Documents and SettingsboxMy DocumentsCSCSC220ReaderProgramsReaderFilesCh
• push and pop operations are performed in O(1)
time.
8. Example of Stack codes
• Reversed word
• What is it?
• ABC -> CBA
C:Documents and SettingsboxMy DocumentsCS
9. Example of Stack codes
• BracketChecker (balancer)
• A syntax checker (compiler) that understands a
language containing any strings with balanced
brackets ‘{‘ ‘[‘ ‘(‘ and ‘)’, ‘]’, ‘}’
– S -> Bl S1 Br
– S1 -> Bl string Br
– Bl -> ‘{‘ | ‘[‘ | ‘(‘
– Br -> ‘)’, | ‘]’, | ‘}’
C:Documents and SettingsboxMy
DocumentsCSCSC220ReaderProgramsReaderFile
sChap04Bracketsbrackets.java
10. Queues
• Queue is an ADT data structure similar to stack, except
that the first item to be inserted is the first one to be
removed.
• This mechanism is called First-In-First-Out (FIFO).
• Placing an item in a queue is called “insertion or
enqueue”, which is done at the end of the queue called
“rear”.
• Removing an item from a queue is called “deletion or
dequeue”, which is done at the other end of the queue
called “front”.
• Some of the applications are : printer queue, keystroke
queue, etc.
11. Circular Queue
• When a new item is inserted at the rear, the
pointer to rear moves upwards.
• Similarly, when an item is deleted from the queue
the front arrow moves downwards.
• After a few insert and delete operations the rear
might reach the end of the queue and no more
items can be inserted although the items from
the front of the queue have been deleted and
there is space in the queue.
12. Circular Queue
• To solve this problem, queues implement
wrapping around. Such queues are called
Circular Queues.
• Both the front and the rear pointers wrap around
to the beginning of the array.
• It is also called as “Ring buffer”.
• Items can inserted and deleted from a queue in
O(1) time.
13. Queue Example
+Queue()
+insert() : void
+remove() : long
+peekFront() : long
+isEmpty() : bool
+isFull() : bool
+size() : int
-maxSize : int
-queueArray [] : long
-front : int
-rear : int
-nItems : int
Queue
QueueApp
Interface1
15. Various Queues
• Normal queue (FIFO)
• Circular Queue (Normal Queue)
• Double-ended Queue (Deque)
• Priority Queue
16. Deque
• It is a double-ended queue.
• Items can be inserted and deleted from either
ends.
• More versatile data structure than stack or
queue.
• E.g. policy-based application (e.g. low priority go
to the end, high go to the front)
• In a case where you want to sort the queue once
in a while, What sorting algorithm will you use?
17. Priority Queues
• More specialized data structure.
• Similar to Queue, having front and rear.
• Items are removed from the front.
• Items are ordered by key value so that the item
with the lowest key (or highest) is always at the
front.
• Items are inserted in proper position to maintain
the order.
• Let’s discuss complexity
18. Priority Queue
Example
+Queue()
+insert() : void
+remove() : long
+peekMin() : long
+isEmpty() : bool
+isFull() : bool
-maxSize : int
-queueArray [] : long
-nItems : int
PrioityQ
PriorityQApp
Interface1
19. Priority Queues
• Used in multitasking operating system.
• They are generally represented using
“heap” data structure.
• Insertion runs in O(n) time, deletion in O(1)
time.
• C:Documents and SettingsboxMy
DocumentsCSCSC220ReaderPrograms
ReaderFilesChap04PriorityQpriorityQ.ja
va
20. Parsing Arithmetic
Expressions
• 2 + 3
• 2 + 4 * 5
• ((2 + 4) * 7) + 3* (9 – 5))
• Infix vs postfix
• Why do we want to do this
transformation?
• 2 3 +
• 2 4 5 * +
• 2 4 + 7 * 3 9 5 - * +
21. Infix to postfix
• Read ch from input until empty
– If ch is arg , output = output + arg
– If ch is “(“, push ‘(‘;
– If ch is op and higher than top push ch
– If ch is “)” or end of input,
• output = output + pop() until empty or top is “(“
– Read next input
• C:Documents and SettingsboxMy
DocumentsCSCSC220ReaderProgramsRead
erFilesChap04Postfixpostfix.java
22. Postfix eval
• 5 + 2 * 3 -> 5 2 3 * +
• Algorithm
– While input is not empty
– If ch is number , push (ch)
– Else
• Pop (a)
• Pop(b)
• Eval (ch, a, b)
• C:Documents and SettingsboxMy
DocumentsCSCSC220ReaderProgramsRead
erFilesChap04Postfixpostfix.java
24. Another Real world
example
• <?xml version = "1.0"?>
• <!-- An author -->
• <author>
• <name gender = "male">
• <first> Art </first>
• <last> Gittleman </last>
• </name>
• </author>