This document discusses stacks and queues as data structures. It begins with an overview of stacks, including their definition as a last-in, first-out abstract data type and common stack operations. Array implementation of stacks is described through examples of push and pop operations. The document also covers applications of stacks and different notation styles for arithmetic expressions. Next, queues are introduced as first-in, first-out data structures, with details on their array representation and operations like enqueue and dequeue. Implementation of queues using arrays and handling overflow/underflow conditions are explained.
The document discusses stacks and queues as abstract data types. It describes their basic operations and implementations using arrays. Stacks follow LIFO (last-in, first-out) order and can be used for applications like undo operations. Queues follow FIFO (first-in, first-out) order and can be used where ordering of elements is important, like in printing queues. The document also discusses infix, prefix and postfix notations for arithmetic expressions and provides an algorithm to convert infix to postfix notation using a stack. Finally, it describes different types of queues including linear and circular queues.
The document discusses stacks and queues as abstract data types. It describes stacks as last-in, first-out (LIFO) data structures that can be implemented using arrays or linked lists. Elements are inserted and removed from one end, called the top. Similarly, queues are first-in, first-out (FIFO) structures where elements are inserted at the rear and removed from the front. Common operations for both include push/enqueue, pop/dequeue, isEmpty, and isFull. Example code demonstrates implementing stacks and queues in C using arrays and linked lists. Applications are given such as undo functions, method call stacks, and waiting lists.
The document discusses stacks and queues as data structures. Stacks follow LIFO (Last In First Out) and allow insertion and deletion from one end only. Queues follow FIFO (First In First Out) and allow insertion from one end and deletion from the other. Both can be implemented using arrays or linked lists. Common operations on stacks are push and pop, while common operations on queues are insert and delete.
The document discusses stacks and queues as data structures. Stacks follow LIFO (Last In First Out) and involve push and pop operations on an array or linked list. Queues follow FIFO (First In First Out) and involve insert and delete operations, with insertion at the rear and deletion at the front. The document provides examples of implementing stacks and queues using arrays and linked lists, and describes the basic operations like creation, insertion, deletion, checking for empty/full.
The document discusses stacks, which are abstract data types that implement a last-in, first-out (LIFO) principle. Stacks can be implemented using arrays or linked lists. The key stack operations are push, which adds an element to the top of the stack, pop, which removes an element from the top of the stack, and operations to check if a stack is empty or full. The document provides examples of implementing stacks using arrays and linked lists. It also discusses applications of stacks like undo operations, method calls, and converting infix notation to postfix notation using a stack.
The document discusses stacks and queues as linear data structures. It defines stacks and queues, describes their common operations like push, pop, insert and delete, and ways to implement them using arrays and linked lists. Array implementation of stacks and queues is shown along with diagrams. Linked list implementation of stacks and queues is also discussed with diagrams showing the insertion and deletion of nodes. Sample programs to implement stacks and queues using both arrays and linked lists are mentioned.
The document discusses stacks and queues as linear data structures. It defines stacks and queues, describes their common operations like push, pop, insert and delete, and ways to implement them using arrays and linked lists. Array implementation of stacks and queues is shown along with diagrams. Linked list implementation of stacks and queues is also discussed with diagrams showing the insertion and deletion of nodes. Sample programs to implement stacks and queues using arrays and linked lists are mentioned.
This document discusses stacks and queues, which are abstract data types commonly used in programming. It describes their basic principles and operations, as well as implementations using arrays and linked lists. Stacks follow LIFO (last-in, first-out) order, while queues follow FIFO (first-in, first-out) order. The document provides examples of using stacks and queues to evaluate expressions, check parentheses matching, and manage memory and shared resources.
The document discusses stacks and queues as abstract data types. It describes their basic operations and implementations using arrays. Stacks follow LIFO (last-in, first-out) order and can be used for applications like undo operations. Queues follow FIFO (first-in, first-out) order and can be used where ordering of elements is important, like in printing queues. The document also discusses infix, prefix and postfix notations for arithmetic expressions and provides an algorithm to convert infix to postfix notation using a stack. Finally, it describes different types of queues including linear and circular queues.
The document discusses stacks and queues as abstract data types. It describes stacks as last-in, first-out (LIFO) data structures that can be implemented using arrays or linked lists. Elements are inserted and removed from one end, called the top. Similarly, queues are first-in, first-out (FIFO) structures where elements are inserted at the rear and removed from the front. Common operations for both include push/enqueue, pop/dequeue, isEmpty, and isFull. Example code demonstrates implementing stacks and queues in C using arrays and linked lists. Applications are given such as undo functions, method call stacks, and waiting lists.
The document discusses stacks and queues as data structures. Stacks follow LIFO (Last In First Out) and allow insertion and deletion from one end only. Queues follow FIFO (First In First Out) and allow insertion from one end and deletion from the other. Both can be implemented using arrays or linked lists. Common operations on stacks are push and pop, while common operations on queues are insert and delete.
The document discusses stacks and queues as data structures. Stacks follow LIFO (Last In First Out) and involve push and pop operations on an array or linked list. Queues follow FIFO (First In First Out) and involve insert and delete operations, with insertion at the rear and deletion at the front. The document provides examples of implementing stacks and queues using arrays and linked lists, and describes the basic operations like creation, insertion, deletion, checking for empty/full.
The document discusses stacks, which are abstract data types that implement a last-in, first-out (LIFO) principle. Stacks can be implemented using arrays or linked lists. The key stack operations are push, which adds an element to the top of the stack, pop, which removes an element from the top of the stack, and operations to check if a stack is empty or full. The document provides examples of implementing stacks using arrays and linked lists. It also discusses applications of stacks like undo operations, method calls, and converting infix notation to postfix notation using a stack.
The document discusses stacks and queues as linear data structures. It defines stacks and queues, describes their common operations like push, pop, insert and delete, and ways to implement them using arrays and linked lists. Array implementation of stacks and queues is shown along with diagrams. Linked list implementation of stacks and queues is also discussed with diagrams showing the insertion and deletion of nodes. Sample programs to implement stacks and queues using both arrays and linked lists are mentioned.
The document discusses stacks and queues as linear data structures. It defines stacks and queues, describes their common operations like push, pop, insert and delete, and ways to implement them using arrays and linked lists. Array implementation of stacks and queues is shown along with diagrams. Linked list implementation of stacks and queues is also discussed with diagrams showing the insertion and deletion of nodes. Sample programs to implement stacks and queues using arrays and linked lists are mentioned.
This document discusses stacks and queues, which are abstract data types commonly used in programming. It describes their basic principles and operations, as well as implementations using arrays and linked lists. Stacks follow LIFO (last-in, first-out) order, while queues follow FIFO (first-in, first-out) order. The document provides examples of using stacks and queues to evaluate expressions, check parentheses matching, and manage memory and shared resources.
This document discusses stacks and their use as a data structure. It begins by defining what a stack is, namely a data structure that follows the last-in, first-out (LIFO) principle. Common stack operations like push, pop, and peek are introduced. Examples are given of how stacks are used in applications like undo mechanisms, expression evaluation, and validating parentheses in expressions. The key operations and algorithms for implementing a stack are described, including pseudocode for push, pop, and display functions. Finally, examples are provided of how stacks can be used to reverse strings, validate parentheses, and convert infix expressions to postfix form.
The document describes implementing a queue using an array. It provides algorithms for enQueue() and deQueue() operations. EnQueue() inserts elements at the rear by incrementing rear and checking for full. DeQueue() deletes elements from the front by incrementing front and checking for empty. The queue uses front and rear pointers to manage insertion and deletion of elements based on FIFO principle using an underlying fixed-size array.
Data structures like stacks, queues, and priority queues can be implemented in Python using built-in data types and modules. Stacks follow LIFO order, with new items added to the top and removed from the top. Queues follow FIFO order, with new items added to the back and removed from the front. Priority queues order items by priority, so the highest or lowest priority item is removed first depending on the implementation.
This document discusses stacks and their applications. It begins with an introduction to stacks, describing them as data structures that follow the last-in, first-out (LIFO) principle. It then outlines stack operations like push, pop, top, and describes how stacks can be implemented using arrays or linked lists. Several applications of stacks are mentioned, including parenthesis matching, expression evaluation in postfix notation, handling function calls and returns, and undo sequences. Examples are provided to illustrate postfix notation, converting infix to postfix expressions, and evaluating postfix expressions using a stack.
This document discusses stack applications and operations. It provides examples of how stacks can be used for reversing data, converting decimal to binary, evaluating arithmetic expressions by converting infix to postfix notation, and backtracking. Basic stack operations include push, pop, and peeking at the top element. Stacks follow LIFO order and are commonly implemented using arrays or linked lists. Common applications include reversing strings or files, evaluating arithmetic expressions, and backtracking to achieve goals.
The document discusses stacks and queues. It begins by defining a stack as a collection of homogeneous data elements where insertion and deletion occurs at one end, known as the top. The stack follows the LIFO (last in, first out) principle. Common stack operations like push and pop are introduced. Implementing stacks using both arrays and linked lists is covered. Applications of stacks like balancing symbols, recursion, undo operations are mentioned. The document then moves to discussing queues, their applications and implementations. Priority queues and their applications are also briefly covered.
The document discusses stacks in C++. It defines a stack as a data structure that follows LIFO (Last In First Out) principle where the last element added is the first to be removed. Stacks can be implemented using arrays or linked lists. The key operations on a stack are push which adds an element and pop which removes an element. Example applications of stacks include function call stacks, converting infix to postfix notation, and reversing arrays.
The document discusses the stack data structure. A stack is a collection of elements that follow the LIFO (last-in, first-out) principle. Elements can be inserted and removed from the top of the stack only. Stacks have common applications like undo functions in text editors and web browser history. Formally, a stack is an abstract data type that supports push, pop, top, is_empty and length operations. The document provides examples and explanations of stack operations and applications like infix to postfix conversion, expression evaluation, balancing symbols, function calls and reversing a string.
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxKALPANAC20
This document discusses stacks as a data structure. It defines a stack as a Last In First Out (LIFO) structure where the last item inserted is the first out. Key stack operations like push, pop, peek and isEmpty are described. Examples of stack applications include checking for balanced brackets, converting infix to postfix notation, implementing an undo/redo feature and recursion. The document also provides pseudocode for converting an infix expression to postfix using a stack and describes how a postfix calculator evaluates expressions.
This document discusses stacks and queues as linear data structures. It defines stacks as last-in, first-out (LIFO) collections where the last item added is the first removed. Queues are first-in, first-out (FIFO) collections where the first item added is the first removed. Common stack and queue operations like push, pop, insert, and remove are presented along with algorithms and examples. Applications of stacks and queues in areas like expression evaluation, string reversal, and scheduling are also covered.
An abstract data type (ADT) is a mathematical model for data structures that defines the type solely by the operations that can be performed on it. For example, a stack ADT can be defined by two operations: push, which inserts an item into the stack, and pop, which removes the top item. Abstract data types are theoretical entities used to simplify algorithm descriptions and formally describe programming language type systems. A stack is a linear data structure that follows the last-in, first-out principle, where items can only be inserted or removed from one end of the stack. Stacks have common applications in arithmetic expression evaluation, backtracking, and function call processing.
This document discusses stacks, which are linear data structures that follow a first-in, last-out (FILO) principle. Stacks can be implemented using arrays or linked lists. Key stack operations include push, which adds an element to the top of the stack, and pop, which removes an element from the top. Stacks have applications in recursion, expression evaluation, simulating recursion, and algorithms like depth-first search and quicksort. The document provides examples and pseudocode for stack operations and implementations using arrays and linked lists.
The document discusses stacks and their implementation and use in evaluating arithmetic expressions. It defines a stack as a collection of elements that can only be inserted or removed from one end, called the top. Stacks follow a last-in, first-out (LIFO) principle. Arrays can be used to implement stacks, with a pointer tracking the current top element. Common stack operations like push, pop, peek, etc. are described. Stacks are useful for converting infix expressions to postfix and then evaluating them, as operators are processed after their operands in postfix notation.
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptxPrakash Zodge
In short...The stack organization is very effective in evaluating arithmetic expressions. Expressions are usually represented in what is known as Infix notation, in which each operator is written between two operands (i.e., A + B)....
The section provides brief introduction to stack and its operations (PUSH and POP) along with the implementation of stack in real scenario to convert infix expression to postfix expression.
The document discusses stacks and their implementation and use. It begins by defining a stack as a collection of items that can be inserted or deleted from one end, following the LIFO principle. Common stack operations like push, pop and top are introduced. Stacks can be implemented using arrays or linked lists. The use of stacks to evaluate expressions in prefix, infix and postfix notations is covered, including the precedence of operators and the process to convert infix to postfix notation using a stack. Parentheses are also discussed in the conversion process.
The document discusses stacks, which are linear data structures that follow the LIFO (last in, first out) principle. Stacks can be implemented using arrays or linked lists. Elements are inserted and removed only from one end, called the top of the stack. Insertion is called pushing and removal is called popping. Stacks are used extensively in computer systems, for example in operating system function calls and interrupt handling. The Java programming language contains a Stack class that can be used by programmers.
The document discusses stacks and their operations. It defines a stack as a data structure where insertion and deletion takes place at one end (the top). The basic stack operations are push, which adds an element to the top, and pop, which removes an element from the top. Additional operations include peek to view the top element without removing it, and isEmpty and isFull to check the status of the stack. Algorithms for these operations and for converting between infix, postfix, and prefix notation are presented.
This document discusses stacks and queues, which are linear data structures. Stacks follow LIFO (last in, first out) and use push and pop operations. Queues follow FIFO (first in, first out) and use insertion at the rear and deletion at the front. Real-world examples of stacks include discs in a holder and tokens in a stack. Real-world examples of queues include lines at counters. Stacks and queues have various applications like reversing strings, expression evaluation, job scheduling, and memory/process management in operating systems.
A stack is a linear data structure that follows the LIFO (last in, first out) principle. Elements are inserted and removed from the top of the stack. Common stack operations include push to add an element and pop to remove the top element. Stacks can be implemented using arrays or linked lists. Stacks are useful for operations like converting infix expressions to postfix and evaluating postfix expressions using a stack to hold operands. Queues follow the FIFO (first in, first out) principle with elements added to the rear and removed from the front. Common queue operations are enqueue to add and dequeue to remove elements. Queues can also be implemented using arrays or linked lists. Linked lists store elements in nodes with each node
The document discusses key concepts in data warehouse architecture including:
1) The functions of data warehouse tools which extract, clean, transform, load, and refresh data from source systems.
2) Key terminologies like metadata, which provides information about the data warehouse contents, and dimensional modeling using facts, dimensions, and data cubes.
3) Common multidimensional data models like star schemas with a central fact table linked to dimension tables and snowflake schemas which further normalize dimension tables.
The document discusses the Data Mining Query Language (DMQL), which was proposed for the DBMiner data mining system. DMQL is based on SQL and allows users to define data mining tasks by specifying data warehouses, data marts, and types of knowledge to mine, such as characterization, discrimination, association, classification, and prediction. It also provides syntax for concept hierarchy specification to organize data attributes into different levels.
This document discusses stacks and their use as a data structure. It begins by defining what a stack is, namely a data structure that follows the last-in, first-out (LIFO) principle. Common stack operations like push, pop, and peek are introduced. Examples are given of how stacks are used in applications like undo mechanisms, expression evaluation, and validating parentheses in expressions. The key operations and algorithms for implementing a stack are described, including pseudocode for push, pop, and display functions. Finally, examples are provided of how stacks can be used to reverse strings, validate parentheses, and convert infix expressions to postfix form.
The document describes implementing a queue using an array. It provides algorithms for enQueue() and deQueue() operations. EnQueue() inserts elements at the rear by incrementing rear and checking for full. DeQueue() deletes elements from the front by incrementing front and checking for empty. The queue uses front and rear pointers to manage insertion and deletion of elements based on FIFO principle using an underlying fixed-size array.
Data structures like stacks, queues, and priority queues can be implemented in Python using built-in data types and modules. Stacks follow LIFO order, with new items added to the top and removed from the top. Queues follow FIFO order, with new items added to the back and removed from the front. Priority queues order items by priority, so the highest or lowest priority item is removed first depending on the implementation.
This document discusses stacks and their applications. It begins with an introduction to stacks, describing them as data structures that follow the last-in, first-out (LIFO) principle. It then outlines stack operations like push, pop, top, and describes how stacks can be implemented using arrays or linked lists. Several applications of stacks are mentioned, including parenthesis matching, expression evaluation in postfix notation, handling function calls and returns, and undo sequences. Examples are provided to illustrate postfix notation, converting infix to postfix expressions, and evaluating postfix expressions using a stack.
This document discusses stack applications and operations. It provides examples of how stacks can be used for reversing data, converting decimal to binary, evaluating arithmetic expressions by converting infix to postfix notation, and backtracking. Basic stack operations include push, pop, and peeking at the top element. Stacks follow LIFO order and are commonly implemented using arrays or linked lists. Common applications include reversing strings or files, evaluating arithmetic expressions, and backtracking to achieve goals.
The document discusses stacks and queues. It begins by defining a stack as a collection of homogeneous data elements where insertion and deletion occurs at one end, known as the top. The stack follows the LIFO (last in, first out) principle. Common stack operations like push and pop are introduced. Implementing stacks using both arrays and linked lists is covered. Applications of stacks like balancing symbols, recursion, undo operations are mentioned. The document then moves to discussing queues, their applications and implementations. Priority queues and their applications are also briefly covered.
The document discusses stacks in C++. It defines a stack as a data structure that follows LIFO (Last In First Out) principle where the last element added is the first to be removed. Stacks can be implemented using arrays or linked lists. The key operations on a stack are push which adds an element and pop which removes an element. Example applications of stacks include function call stacks, converting infix to postfix notation, and reversing arrays.
The document discusses the stack data structure. A stack is a collection of elements that follow the LIFO (last-in, first-out) principle. Elements can be inserted and removed from the top of the stack only. Stacks have common applications like undo functions in text editors and web browser history. Formally, a stack is an abstract data type that supports push, pop, top, is_empty and length operations. The document provides examples and explanations of stack operations and applications like infix to postfix conversion, expression evaluation, balancing symbols, function calls and reversing a string.
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxKALPANAC20
This document discusses stacks as a data structure. It defines a stack as a Last In First Out (LIFO) structure where the last item inserted is the first out. Key stack operations like push, pop, peek and isEmpty are described. Examples of stack applications include checking for balanced brackets, converting infix to postfix notation, implementing an undo/redo feature and recursion. The document also provides pseudocode for converting an infix expression to postfix using a stack and describes how a postfix calculator evaluates expressions.
This document discusses stacks and queues as linear data structures. It defines stacks as last-in, first-out (LIFO) collections where the last item added is the first removed. Queues are first-in, first-out (FIFO) collections where the first item added is the first removed. Common stack and queue operations like push, pop, insert, and remove are presented along with algorithms and examples. Applications of stacks and queues in areas like expression evaluation, string reversal, and scheduling are also covered.
An abstract data type (ADT) is a mathematical model for data structures that defines the type solely by the operations that can be performed on it. For example, a stack ADT can be defined by two operations: push, which inserts an item into the stack, and pop, which removes the top item. Abstract data types are theoretical entities used to simplify algorithm descriptions and formally describe programming language type systems. A stack is a linear data structure that follows the last-in, first-out principle, where items can only be inserted or removed from one end of the stack. Stacks have common applications in arithmetic expression evaluation, backtracking, and function call processing.
This document discusses stacks, which are linear data structures that follow a first-in, last-out (FILO) principle. Stacks can be implemented using arrays or linked lists. Key stack operations include push, which adds an element to the top of the stack, and pop, which removes an element from the top. Stacks have applications in recursion, expression evaluation, simulating recursion, and algorithms like depth-first search and quicksort. The document provides examples and pseudocode for stack operations and implementations using arrays and linked lists.
The document discusses stacks and their implementation and use in evaluating arithmetic expressions. It defines a stack as a collection of elements that can only be inserted or removed from one end, called the top. Stacks follow a last-in, first-out (LIFO) principle. Arrays can be used to implement stacks, with a pointer tracking the current top element. Common stack operations like push, pop, peek, etc. are described. Stacks are useful for converting infix expressions to postfix and then evaluating them, as operators are processed after their operands in postfix notation.
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptxPrakash Zodge
In short...The stack organization is very effective in evaluating arithmetic expressions. Expressions are usually represented in what is known as Infix notation, in which each operator is written between two operands (i.e., A + B)....
The section provides brief introduction to stack and its operations (PUSH and POP) along with the implementation of stack in real scenario to convert infix expression to postfix expression.
The document discusses stacks and their implementation and use. It begins by defining a stack as a collection of items that can be inserted or deleted from one end, following the LIFO principle. Common stack operations like push, pop and top are introduced. Stacks can be implemented using arrays or linked lists. The use of stacks to evaluate expressions in prefix, infix and postfix notations is covered, including the precedence of operators and the process to convert infix to postfix notation using a stack. Parentheses are also discussed in the conversion process.
The document discusses stacks, which are linear data structures that follow the LIFO (last in, first out) principle. Stacks can be implemented using arrays or linked lists. Elements are inserted and removed only from one end, called the top of the stack. Insertion is called pushing and removal is called popping. Stacks are used extensively in computer systems, for example in operating system function calls and interrupt handling. The Java programming language contains a Stack class that can be used by programmers.
The document discusses stacks and their operations. It defines a stack as a data structure where insertion and deletion takes place at one end (the top). The basic stack operations are push, which adds an element to the top, and pop, which removes an element from the top. Additional operations include peek to view the top element without removing it, and isEmpty and isFull to check the status of the stack. Algorithms for these operations and for converting between infix, postfix, and prefix notation are presented.
This document discusses stacks and queues, which are linear data structures. Stacks follow LIFO (last in, first out) and use push and pop operations. Queues follow FIFO (first in, first out) and use insertion at the rear and deletion at the front. Real-world examples of stacks include discs in a holder and tokens in a stack. Real-world examples of queues include lines at counters. Stacks and queues have various applications like reversing strings, expression evaluation, job scheduling, and memory/process management in operating systems.
A stack is a linear data structure that follows the LIFO (last in, first out) principle. Elements are inserted and removed from the top of the stack. Common stack operations include push to add an element and pop to remove the top element. Stacks can be implemented using arrays or linked lists. Stacks are useful for operations like converting infix expressions to postfix and evaluating postfix expressions using a stack to hold operands. Queues follow the FIFO (first in, first out) principle with elements added to the rear and removed from the front. Common queue operations are enqueue to add and dequeue to remove elements. Queues can also be implemented using arrays or linked lists. Linked lists store elements in nodes with each node
The document discusses key concepts in data warehouse architecture including:
1) The functions of data warehouse tools which extract, clean, transform, load, and refresh data from source systems.
2) Key terminologies like metadata, which provides information about the data warehouse contents, and dimensional modeling using facts, dimensions, and data cubes.
3) Common multidimensional data models like star schemas with a central fact table linked to dimension tables and snowflake schemas which further normalize dimension tables.
The document discusses the Data Mining Query Language (DMQL), which was proposed for the DBMiner data mining system. DMQL is based on SQL and allows users to define data mining tasks by specifying data warehouses, data marts, and types of knowledge to mine, such as characterization, discrimination, association, classification, and prediction. It also provides syntax for concept hierarchy specification to organize data attributes into different levels.
Quicksort is a widely used sorting algorithm that follows the divide and conquer paradigm. It works by recursively choosing a pivot element in an array, partitioning the array such that all elements less than the pivot come before all elements greater than the pivot, and then applying the same approach recursively to the sub-arrays. This has the effect of sorting the array in place with each iteration reducing the problem size until the entire array is sorted. The document provides pseudocode to implement quicksort and explains the algorithm at a high level.
This document discusses the architecture of knowledge-based systems (KBS). It explains that a KBS contains a knowledge module called the knowledge base (KB) and a control module called the inference engine. The KB explicitly represents knowledge that can be easily updated by domain experts without programming expertise. A knowledge engineer acts as a liaison between domain experts and the computer implementation. Propositional logic is then introduced as a basic technique for representing knowledge in KBS. It represents statements as atomic or compound propositions connected by logical operators like negation, conjunction, disjunction, implication, and biconditional.
Knowledge representation techniques are used to store knowledge in artificial intelligence systems so they can understand the world and solve complex problems. There are several common techniques, including logic, rules, semantic networks, frames, and scripts. Ontological engineering is used to develop large, modular ontologies that represent complex domains and allow knowledge to be integrated and combined. For knowledge representation systems to be effective, they must adequately and efficiently represent, store, manipulate, and acquire new knowledge.
The document discusses various file allocation methods and disk scheduling algorithms. There are three main file allocation methods - contiguous allocation, linked allocation, and indexed allocation. Contiguous allocation suffers from fragmentation but allows fast sequential access. Linked allocation does not have external fragmentation but is slower. Indexed allocation supports direct access but has higher overhead. For disk scheduling, algorithms like FCFS, SSTF, SCAN, CSCAN, and LOOK are described. SSTF provides lowest seek time while SCAN and CSCAN have higher throughput but longer wait times.
This document discusses segmentation in operating systems. Segmentation divides memory into variable-sized segments rather than fixed pages. Each process is divided into segments like the main program, functions, variables, etc. There are two types of segmentation: virtual memory segmentation which loads segments non-contiguously and simple segmentation which loads all segments together at once but non-contiguously in memory. Segmentation uses a segment table to map the two-part logical address to the single physical address through looking up the segment base address.
This document discusses virtual memory and demand paging. It explains that virtual memory separates logical memory from physical memory, allowing for larger address spaces than physical memory. Demand paging brings pages into memory only when needed, reducing I/O and memory usage. When a page is accessed that is not in memory, a page fault occurs and the operating system handles bringing that page in from disk while selecting a page to replace using an algorithm like FIFO, LRU, or optimal.
A decision tree classifier is explained. Key points include:
- Nodes test attribute values, edges correspond to test outcomes, and leaves predict the class.
- Information gain measures how much a variable contributes to the classification.
- It is used to select the variable that best splits the data at each node, with the highest information gain splitting the root node.
- An example calculates information gain for road type, obstruction, and speed limit variables to classify car speed. Speed limit has the highest information gain of 1 and is used to build the decision tree.
The document discusses the Apriori algorithm for frequent itemset mining. It explains that the Apriori algorithm uses an iterative approach consisting of join and prune steps to discover frequent itemsets that occur together above a minimum support threshold. The algorithm first finds all frequent 1-itemsets, then generates and prunes longer candidate itemsets in each iteration until no further frequent itemsets are found.
The document discusses the key components of a big data architecture. It describes how a big data architecture is needed to handle large volumes of data from multiple sources that is too large for traditional databases. The architecture ingests data from various sources, stores it, enables both batch and real-time analysis, and delivers business insights to users. It also provides examples of Flipkart's data platform which includes components like an ingestion system, batch/streaming processing, and a messaging queue.
This document provides an introduction to knowledge representation in artificial intelligence. It discusses how knowledge representation and reasoning forms the basis of intelligent behavior through computational means. The key types of knowledge that need to be represented are defined, including objects, events, facts, and meta-knowledge. Different types of knowledge such as declarative, procedural, structural and heuristic knowledge are explained. The importance of knowledge representation for modeling intelligent behavior in agents is highlighted. The requirements for effective knowledge representation including representational adequacy, inferential adequacy, inferential efficiency, and acquisitional efficiency are outlined. Propositional logic is introduced as the simplest form of logic using propositions.
Artificial intelligence (AI) is the simulation of human intelligence processes by machines, especially computer systems. Specific applications of AI include expert systems, natural language processing, speech recognition, and machine vision. The document discusses what intelligence and artificial intelligence are, provides definitions and examples of artificial intelligence, and explains how artificial intelligence works through machine learning algorithms. It also covers the goals, history, and advantages of artificial intelligence.
This document discusses Java threads. It defines threads as portions of a program that can execute concurrently, allowing tasks to be performed in parallel like downloading a file while playing video. There are two main ways to create threads in Java: by extending the Thread class or implementing the Runnable interface. The life cycle of a thread involves states like ready, running, blocked, waiting, and dead. Thread priorities and scheduling determine which ready threads get processor time.
The document discusses Java applets including their architecture, lifecycle, and event handling mechanisms. It describes the four lifecycle methods - init(), start(), stop(), and destroy() - and how applets are initialized, started, painted, stopped, and destroyed. It also discusses how to pass parameters to applets and run applets using HTML or the appletviewer tool.
JavaScript functions allow code to be reused and run when invoked. Functions are defined using the function keyword and name and can take parameters. To call a function, its name is written and the code inside will execute. Functions can return values and be invoked from events, code, or automatically. They allow code reuse and running code with different arguments to produce different results.
The document discusses various JavaScript operators such as arithmetic, assignment, comparison, logical, and type operators. It provides code examples of using operators to assign values to variables, add and concatenate numbers and strings, compare values, and perform conditional logic. The document also covers JavaScript conditional statements including if/else and switch statements for executing different code blocks based on various conditions.
This document discusses CSS text formatting properties including text color, alignment, decoration, transformation, indentation, letter spacing, and line height. It provides examples of how each property can be used by specifying the property name and value in a CSS style rule. For example, to center align text the text-align property is set to center. Various text formatting properties allow control over text color, positioning, effects, spacing, and other visual aspects through CSS.
This document provides an overview of CSS (Cascading Style Sheets) including what CSS is, how to write CSS style rules, and the different ways to add CSS styles to a webpage. CSS is a styling language that tells browsers how to display elements on a webpage by allowing the setting of properties like color, font, margins etc. Style rules are written with a selector that specifies the HTML element and a declaration with a property and value to set the style. Styles can be added inline within an HTML element, internally within <style> tags in the head, or externally in a separate .css file linked via <link>.
- A newsgroup is an online discussion forum accessible through Usenet that allows users to post and read messages on a specific topic indicated in the newsgroup name.
- Newsgroups are organized into a hierarchy with categories and subcategories separated by periods in the newsgroup name. When a user submits a post, it is distributed to all Usenet servers which then share it with connected servers until all are updated.
- The key differences between newsgroups and mailing lists are that newsgroups are open forums accessible through Usenet servers while mailing lists require subscription and messages are distributed through a central list server to subscribed members only.
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
Temple of Asclepius in Thrace. Excavation resultsKrassimira Luka
The temple and the sanctuary around were dedicated to Asklepios Zmidrenus. This name has been known since 1875 when an inscription dedicated to him was discovered in Rome. The inscription is dated in 227 AD and was left by soldiers originating from the city of Philippopolis (modern Plovdiv).
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
1. Data Structures
1 Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
Dr. G. Jasmine Beulah
Dept. Computer Science,
Kristu Jayanti College(UG)
Bengaluru
2. Stack
Stack - Definition; Array representation of stack; Operations on
stack; Polish notation; Reverse Polish notation; Applications of
stack, Conversion of an infix arithmetic expression to postfix,
Evaluation of postfix expression
2 Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
5. Basic Idea
• A stack is an Abstract Data Type (ADT), commonly used in most
programming languages. It is named stack as it behaves like a real-
world stack, for example – a deck of cards or a pile of plates, etc.
5 Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
6. Stack Representation
• Can be implemented by means of Array, Structure, Pointers and
Linked List.
• Stack can either be a fixed size or dynamic.
6 Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
8. STACK: Last-In-First-Out (LIFO)
*An abstract data type (ADT) is an abstraction of a data structure
*An ADT specifies:
*Data stored
*Operations on the data
8
Assumption: stack contains integer elements!
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
9. Objects:
* A finite sequence of nodes
Operations:
*Create
*push(): Insert element at top on the stack
*peek(): Return top element without removing it
*pop(): Remove and return top element
*isEmpty(): check if stack is empty
*isfull() : test if stack is full
*Stack ADT
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES 9
13. • In the array implementation, we would:
• Declare an array of fixed size (which determines the maximum
size of the stack).
• Keep a variable which always points to the “top” of the stack.
• Contains the array index of the “top” element.
13
Basic Idea
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
14. Declaration & Stack Creation
14
#define MAXSIZE 10
int stack[MAXSIZE];
int top =-1;
ARRAY
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
15. Checking for Stack Full
15
int isfull()
{
if(top == MAXSIZE)
return 1;
else
return 0;
}
ARRAY
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
16. Checking for stack empty
16
int isempty ()
{
if (top == -1)
return 1;
else
return (0);
}
ARRAY
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
17. Pushing an element into stack
17
int push(int data)
{
if(!isfull())
{
top = top + 1;
stack[top] = data;
}
else
{
printf("Could not insert
data, Stack is full.n");
}
}
ARRAY
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
18. Popping an element from stack
18
int pop()
{
int data;
if(!isempty())
{
data = stack[top];
top = top - 1;
return data;
}
else
{
printf("Could not retrieve data,
Stack is empty.n");
}
}
ARRAY
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
19. Example: A Stack using an Array
19
#include <stdio.h>
#define MAXSIZE 100
struct lifo
{
int st[MAXSIZE];
int top;
};
typedef struct lifo stack;
main() {
stack A, B;
create(&A);
create(&B);
push(&A,10);
push(&A,20);
push(&A,30);
push(&B,100);
push(&B,5);
printf (“%d %d”, pop(&A), pop(&B));
push (&A, pop(&B));
if (isempty(&B))
printf (“n B is empty”);
return;
}
Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
20. Applications of Stacks
• Direct applications:
• Page-visited history in a Web browser
• Undo sequence in a text editor
• Saving local variables when one function calls another, and this one
calls another
20 Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES
22. Notation
*The way to write arithmetic expression is known as a notation.
*An arithmetic expression can be written in three different but equivalent
notations, i.e., without changing the essence or output of an expression.
*These notations are −
Infix Notation
Prefix (Polish) Notation
Postfix (Reverse-Polish) Notation
BCA204A21: DATA STRUCTURES
22 Dr.G.Jasmine Beulah
23. Infix Notation
*In an Infix Notation, operators are used in-between operands.
*e.g. a - b + c, where operators are used in-between operands.
* Humans can easily read, write, and speak in infix notation but the same
does not go well with computing devices.
BCA204A21: DATA STRUCTURES
23 Dr.G.Jasmine Beulah
24. Prefix Notation
*In the Prefix notation, operator is prefixed to operands, i.e. operator is
written ahead of operands.
*For example, +ab. This is equivalent to its infix notation a + b.
*Prefix notation is also known as Polish Notation
BCA204A21: DATA STRUCTURES
24 Dr.G.Jasmine Beulah
25. Postfix Notation
*Postfix notation is also known as Reversed Polish Notation
*In the Postfix notation style, the operator is post-fixed to the operands
i.e., the operator is written after the operands.
*For example, ab+
*This is equivalent to its infix notation a + b.
BCA204A21: DATA STRUCTURES
25 Dr.G.Jasmine Beulah
26. A simple example to show the difference of
the three Notation
BCA204A21: DATA STRUCTURES
26 Dr.G.Jasmine Beulah
27. Infix and Postfix Notations
• Infix: operators placed between operands:
A+B*C
• Postfix: operands appear before their operators:-
ABC*+
• There are no precedence rules to learn in postfix notation, and
parentheses are never needed
BCA204A21: DATA STRUCTURES
27 Dr.G.Jasmine Beulah
28. Infix Postfix
A + B A B +
A + B * C A B C * +
(A + B) * C A B + C *
A + B * C + D A B C * + D +
(A + B) * (C + D) A B + C D + *
A * B + C * D A B * C D * +
A + B * C (A + (B * C)) (A + (B C *) ) A B C * +
A + B * C + D ((A + (B * C)) + D ) ((A + (B C*) )+ D)
((A B C *+) + D) A B C * + D +
28
BCA204A21: DATA STRUCTURES
Infix to Postfix
Dr.G.Jasmine Beulah
29. Infix to postfix conversion
• Use a stack for processing operators (push and pop operations).
• Scan the sequence of operators and operands from left to right and
perform one of the following:
• output the operand,
• push an operator of higher precedence,
• pop an operator and output, till the stack top contains operator of a lower
precedence and push the present operator.
BCA204A21: DATA STRUCTURES 29 Dr.G.Jasmine Beulah
30. The Algorithm Steps…
1. Print operands as they arrive.
2. If the stack is empty or contains a left parenthesis on top, push the incoming operator
onto the stack.
3. If the incoming symbol is a left parenthesis, push it on the stack.
4. If the incoming symbol is a right parenthesis, pop the stack and print the operators
until you see a left parenthesis. Discard the pair of parentheses.
5. If the incoming symbol has higher precedence than the top of the stack, push it on the
stack.
6. If the incoming symbol has equal precedence with the top of the stack, use association.
If the association is left to right, pop and print the top of the stack and then push the
incoming operator. If the association is right to left, push the incoming operator.
7. If the incoming symbol has lower precedence than the symbol on the top of the stack,
pop the stack and print the top operator. Then test the incoming operator against the
new top of stack.
8. At the end of the expression, pop and print all operators on the stack. (No parentheses
should remain.)
BCA204A21: DATA STRUCTURES 30 Dr.G.Jasmine Beulah
31. Infix to Postfix Conversion
Requires operator precedence information
Operands:
Add to postfix expression.
Close parenthesis:
pop stack symbols until an open parenthesis appears.
Operators:
Pop all stack symbols until a symbol of lower precedence appears. Then push
the operator.
End of input:
Pop all remaining stack symbols and add to the expression.
BCA204A21: DATA STRUCTURES 31 Dr.G.Jasmine Beulah
32. Current
symbol
Operator
Stack
Postfix string
1 A A
2 * * A
3 ( * ( A
4 B * ( A B
5 + * ( + A B
6 C * ( + A B C
7 * * ( + * A B C
8 D * ( + * A B C D
9 ) * A B C D * +
10 + + A B C D * + *
11 E + A B C D * + * E
12 A B C D * + * E +
Expression:
A * (B + C * D) + E
becomes
A B C D * + * E +
Postfix notation
is also called as
Reverse Polish
Notation (RPN)
32
BCA204A21: DATA STRUCTURES
Infix to Postfix Rules
Dr.G.Jasmine Beulah
33. Dr.G.Jasmine Beulah
BCA204A21: DATA STRUCTURES 33
Evaluation of Postfix Expression
Algorithm:
1. Scan the postfix expression from left to right.
2. If we encounter an operand, push it on to stack.
3. If we encounter an operator, pop two operands
from the stack.
The first operand popped is an operand 2 and second
popped is operand 1.
4. Perform the desired operation on the operands.
i.e. operand 1 operator operand 2
5. Push the result on to the stack.
6. Repeat the above procedure till the end of inputs
encountered.
36. Basic Idea(FIFO)
• 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).
BCA204A21: DATA STRUCTURES 36 Dr.G.Jasmine Beulah
37. BCA204A21: DATA STRUCTURES 37 Dr.G.Jasmine Beulah
1. A queue can be defined as an ordered list which enables insert
operations to be performed at one end called REAR and delete
operations to be performed at another end called FRONT.
2. Queue is referred to be as First In First Out list.
3. For example, people waiting in line for a rail ticket form a queue.
Queue (FIFO)
38. Queue Representation
• As in stacks, a queue can also be implemented using Arrays, Linked-
lists, Pointers and Structures.
BCA204A21: DATA STRUCTURES 38 Dr.G.Jasmine Beulah
39. BCA204A21: DATA STRUCTURES 39 Dr.G.Jasmine Beulah
QUEUE
enqueue
create
dequeue
size
isempty
Operations of Queue
40. BCA204A21: DATA STRUCTURES 40 Dr.G.Jasmine Beulah
Array representation of Queue
Represent queue by using Linear Arrays.
There are two variables i.e. front and rear, that are implemented in the case of every
queue.
Front and rear variables point to the position from where insertions and deletions are
performed in a queue.
Initially, the value of front and queue is -1 which represents an empty queue.
Initial:
int front =-1
int rear = -1;
41. BCA204A21: DATA STRUCTURES 41 Dr.G.Jasmine Beulah
Queue Insertion
Points to remember when we add an element in the queue:
Check whether the queue has any space to add an element into it.
If the queue has spaces then add the element into the queue by incrementing the REAR
pointer.
Example: Increment the REAR as REAR+1 or REAR++
Queue [Rear] = Item which is used to add an element into the queue
Note: Rear is the position where the item is to be inserted.
void qinsert()
{
int item;
if(rear==max-1)
printf("Queue is full");
else
{
printf("Enter the value to
insertn");
scanf("%d",&item);
rear++;
queue[rear]=item;
} }
42. BCA204A21: DATA STRUCTURES 42 Dr.G.Jasmine Beulah
Queue Overflow
Insertion of an element in a queue is possible only if there is room in the array to fit
in elements.
If the maximum size of the array is reached and if an attempt to insert an element
into the queue that is full, is tried, the condition that occurs is called ‘queue
overflow’.
A function to check whether queue is full or not returns 1 when the queue is full and
returns 0 when the queue is not full.
This function is used to check for queue overflow.
A queue is full when REAR reaches the maximum size of the array used for the
queue i.e. REAR=max-1. FRONT = 0 and REAR = n-1 indicates this condition.
int qfull( )
{
if(rear = = max-1)
return 1;
else
return 0;
}
43. BCA204A21: DATA STRUCTURES 43 Dr.G.Jasmine Beulah
Deletion of element from the queue:
Points to remember when we remove an element from the queue:
Check whether the queue has any element to be deleted.
If so, delete the element from the queue by incrementing the FRONT
pointer. Example: Item= queue[rear]
Increment the front using front++
Note: Rear is the position where the item is to be inserted.
void qdelete()
{
int item;
if(front==rear+1)
printf("Queue is
empty");
else
{
item=queue[front];
printf("%d is
deletedn",item);
front++;
}
}
44. BCA204A21: DATA STRUCTURES 44 Dr.G.Jasmine Beulah
Queue Underflow
Deletion or removal of an element from the queue can be done only if at least one
item is there in the queue.
It means that the queue must be non-empty. An attempt to remove an element from
an empty queue is called ‘queue underflow’.
A function to check whether queue is empty or not return 1 when the queue is empty
and returns 0 when the queue is not empty.
This function is used to check for queue underflow.
int qempty()
{
if(front == rear+1)
return 1;
else return 0;
}
45. BCA204A21: DATA STRUCTURES 45 Dr.G.Jasmine Beulah
Queue display
After deleting an element, the value of front will increase from -1 to 0.
however, the queue will look something like following.
void qdisplay()
{
int item;
int p=front;
if(p==rear+1)
printf("Queue is empty");
else
{
printf("nQueue Elements");
while(p<=rear)
{
printf("%dt",queue[p]);
p++;
}
}
}
47. BCA204A21: DATA STRUCTURES 47 Dr.G.Jasmine Beulah
Disadvantage of Linear Queue:
Using array to implement the queue, will create a problem when the queue is full –
memory space are fixed.
Problem solution
Create a circular queue.
Circular queue wraps around to the
beginning whenever the Head(Front) or the
Tail(Rear) reaches the end of the queue.
48. BCA204A21: DATA STRUCTURES 48 Dr.G.Jasmine Beulah
Circular Queue:
The method of arranging the queue elements Q[1], Q[2], …….. Q[n] in a circular fashion
with Q[1] following Q[n] is called Circular Queue.
A circular queue is similar to a linear queue as it is also based on the FIFO (First
In First Out) principle except that the last position is connected to the first position
in a circular queue that forms a circle.
It is also known as a Ring Buffer.
49. BCA204A21: DATA STRUCTURES 49 Dr.G.Jasmine Beulah
Circular Queue:
Enqueue operation
The steps of enqueue operation are given below:
First, we will check whether the Queue is full or not.
Initially the front and rear are set to -1. When we insert the first element in a Queue, front
and rear both are set to 0.
When we insert a new element, the rear gets incremented, i.e., rear=rear+1.
Let's understand the enqueue and dequeue operation through the
diagrammatic representation.
53. BCA204A21: DATA STRUCTURES 53 Dr.G.Jasmine Beulah
Priority Queue:
A Queue in which it is able to insert elements or remove elements
from any position on some property (such as priority of the task to
be processed) is referred as priority Queue.
An element of higher priority is processed before any element of
lower priority.
Two elements with the same priority are processed according to
the order in which they were added to the queue.
In priority queue, every element has been assigned with a priority
value called priority.
The elements can be inserted or deleted randomly any where in
the queue. Priority queue is a data structure in which prioritized
insertion and deletion operations on elements can be performed
according to their priority values.
55. BCA204A21: DATA STRUCTURES 55 Dr.G.Jasmine Beulah
Ascending Priority Queue:
In this queue, elements can be inserted randomly. The smallest
element of the queue is deleted first.
If elements with equal priority are present, the FIFO technique
is applied.
56. BCA204A21: DATA STRUCTURES 56 Dr.G.Jasmine Beulah
Descending Priority Queue:
In this queue, elements can be inserted randomly.
The largest element of the queue is deleted first.
If elements with equal priority are present, the FIFO technique
is applied
57. BCA204A21: DATA STRUCTURES 57 Dr.G.Jasmine Beulah
Double Ended Queue
A dequeue, also known as a double-ended queue, is an
ordered collection of items similar to the queue.
It has two ends, a front and a rear, and the items remain
positioned in the collection.
What makes a dequeue different is the unrestrictive
nature of adding and removing items.
New items can be added at either the front or the rear.
Likewise, existing items can be removed from either
end.
In a sense, this hybrid linear structure provides all the
capabilities of stacks and queues in a single data
structure.
58. BCA204A21: DATA STRUCTURES 58 Dr.G.Jasmine Beulah
Double Ended Queue
A deque is structured, as described above, as an ordered
collection of items where items are added and removed
from either end, either front or rear. The deque
operations are given below.
59. BCA204A21: DATA STRUCTURES 59 Dr.G.Jasmine Beulah
Double Ended Queue
deque() creates a new deque that is empty. It needs no parameters
and returns an empty deque.
add_front(item) adds a new item to the front of the deque. It needs
the item and returns nothing.
add_rear(item) adds a new item to the rear of the deque. It needs
the item and returns nothing.
remove_front() removes the front item from the deque. It needs no
parameters and returns the item. The deque is modified.
remove_rear() removes the rear item from the deque. It needs no
parameters and returns the item. The deque is modified.
is_empty() tests to see whether the deque is empty. It needs no
parameters and returns a boolean value.
size() returns the number of items in the deque. It needs no
parameters and returns an integer.
60. BCA204A21: DATA STRUCTURES 60 Dr.G.Jasmine Beulah
Applications of Queue:
1. One of the classical areas to which queues can be applied is
simulation. (Simulation is a process of forming an abstract model
from a real situation in order to understand the impact of
modifications and the effect of introducing various strategies on
the situation)
2. Queues find their application in CPU scheduling, in printer
spooling, in message queuing in computer network.