Data Structure Introduction
Data Structure Definition
Data Structure Types
Data Structure Characteristics
Need for Data Structure
Stack Definition
Stack Representation
Stack Operations
Stack Algorithm
Program for Stack in C++
Linked List Definition
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
Linked List Defination
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
Data Structure Introduction
Data Structure Definition
Data Structure Types
Data Structure Characteristics
Need for Data Structure
Stack Definition
Stack Representation
Stack Operations
Stack Algorithm
Program for Stack in C++
Linked List Definition
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
Linked List Defination
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
linked list
singly linked list
insertion in singly linked list
DELETION IN SINGLY LINKED LIST
Searching a singly linked list
Doubly Linked List
insertion from Doubly linked list
DELETION from Doubly LINKED LIST
Searching a doubly linked list
Circular linked list
This presentations gives an introduction to the data structure linked-lists. I discuss the implementation of header-based linked-lists in C. The presentation runs through the code and provides the visualization of the code w.r.t pointers.
Linked List Static and Dynamic Memory AllocationProf Ansari
Static variables are declared and named while writing the program. (Space for them exists as long as the program, in which they are declared, is running.) Static variables cannot be created or destroyed during execution of the program in which they are declared.
Dynamic variables are created (and may be destroyed) during program execution since dynamic variables do not exist while the program is compiled, but only when it is run, they cannot be assigned names while it is being written. The only way to access dynamic variables is by using pointers. Once it is created, however, a dynamic variable does contain data and must have a type like any other variable. If a dynamic variable is created in a function, then it can continue to exist even after the function terminates.
Linked Linear List
We saw in previous chapters how static representation of linear ordered list through Array leads to wastage of memory and in some cases overflows. Now we don't want to assign memory to any linear list in advance instead we want to allocate memory to elements as they are inserted in list. This requires Dynamic Allocation of memory and it can be achieved by using malloc() or calloc() function.
But memory assigned to elements will not be contiguous, which is a requirement for linear ordered list, and was provided by array representation. How we could achieve this?
linked list
singly linked list
insertion in singly linked list
DELETION IN SINGLY LINKED LIST
Searching a singly linked list
Doubly Linked List
insertion from Doubly linked list
DELETION from Doubly LINKED LIST
Searching a doubly linked list
Circular linked list
This presentations gives an introduction to the data structure linked-lists. I discuss the implementation of header-based linked-lists in C. The presentation runs through the code and provides the visualization of the code w.r.t pointers.
Linked List Static and Dynamic Memory AllocationProf Ansari
Static variables are declared and named while writing the program. (Space for them exists as long as the program, in which they are declared, is running.) Static variables cannot be created or destroyed during execution of the program in which they are declared.
Dynamic variables are created (and may be destroyed) during program execution since dynamic variables do not exist while the program is compiled, but only when it is run, they cannot be assigned names while it is being written. The only way to access dynamic variables is by using pointers. Once it is created, however, a dynamic variable does contain data and must have a type like any other variable. If a dynamic variable is created in a function, then it can continue to exist even after the function terminates.
Linked Linear List
We saw in previous chapters how static representation of linear ordered list through Array leads to wastage of memory and in some cases overflows. Now we don't want to assign memory to any linear list in advance instead we want to allocate memory to elements as they are inserted in list. This requires Dynamic Allocation of memory and it can be achieved by using malloc() or calloc() function.
But memory assigned to elements will not be contiguous, which is a requirement for linear ordered list, and was provided by array representation. How we could achieve this?
Class lecture of Data Structure and Algorithms and Python.
Stack, Queue, Tree, Python, Python Code, Computer Science, Data, Data Analysis, Machine Learning, Artificial Intellegence, Deep Learning, Programming, Information Technology, Psuedocide, Tree, pseudocode, Binary Tree, Binary Search Tree, implementation, Binary search, linear search, Binary search operation, real-life example of binary search, linear search operation, real-life example of linear search, example bubble sort, sorting, insertion sort example, stack implementation, queue implementation, binary tree implementation, priority queue, binary heap, binary heap implementation
Trees
Algorithm for searching a node
Inserting a node in BST
Inserting a node
Deleting a node
Deleting a node in BST
Algorithm for deleting node
Deletion in BST
Binary tree traversal methods
Pre-order traversal
In-order traversal
Post order traversal
Construct binary tree
AVL Tree introduction
How to create a AVL tree
How to calclate balance factor
In computer science, tree traversal (also known as tree search) is a form of graph traversal and refers to the process of visiting (checking and/or updating) each node in a tree data structure, exactly once. Such traversals are classified by the order in which the nodes are visited. The following algorithms are described for a binary tree, but they may be generalized to other trees as well.
Feature selection is the process of selecting a subset of the terms occurring in the training set and using only this subset as features in text classification.
Wi-Fi stands for Wireless Fidelity. Fidelity: A faithful output.
Generally used to connect devices in wireless mode.
It is a term that refers to IEEE 802.11 communications
Li-Fi stands for Light Fidelity.
Uses light instead of radio waves.
Uses Visible part of electromagnetic spectrum.
Also known as Light based Wi-Fi.
Communication channels through which news entertainment, education, data, or promotional messages are delivered is known as media. Media includes every broadcasting and narrow-casting medium such as Newspaper, Magazines, Television, Radio, Billboards, Direct mail, Telephone, Fax and Internet.
AGILE TESTING is a testing practice that follows the rules and principles of agile software development. Unlike the Waterfall method, Agile Testing can begin at the start of the project with continuous integration between development and testing. Agile Testing is not sequential but continuous. Agile testing involves testing as early as possible in the software development life-cycle.
Ethical hacking also known as penetration testing or white-hat hacking, involves the same tools, tricks, and techniques that hackers use, but with one major difference that Ethical hacking is legal. It focuses on authorised attempts to gain unauthorised access to systems and find vulnerabilities. Ethical hacking is done with the legal permission of a company to test and increase the security of its systems and networks.
In software engineering and software architecture design, design decisions address architecturally significant requirements; they are perceived as hard to make and/or costly to change. It is called also architecture strategies and tactics.
An algorithm is a plan, a logical step-by-step process for solving a problem. Algorithms are normally written as a flowchart or in pseudo-code.
A flowchart is a diagram that represents a set of instructions. Flowcharts normally use standard symbols to represent the different types of instructions. These symbols are used to construct the flowchart and show the step-by-step solution to the problem.
Software Quality Assurance is a means and practice of monitoring the software engineering processes and methodologies used in a project to ensure proper quality of the software. Scrum is a framework utilising an agile mindset for developing, delivering, and sustaining products in a complex environment.
This presentation defines the asteroids and describes its role in our solar system and how to protect our earth from these space rocks in case of any mishap.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
1. Binary Tree
Prepared by: Afaq Mansoor Khan
BSSE III- Group A
Session 2017-21
IMSciences, Peshawar.
2. Last Lecture Summary
• Introduction to Queue Data Structure
• Types of Queue Data Structures
• Circular QUEUE and its Operations
• Double Ended QUEUE and its operations
3. Objectives Overview
• Introduction to Binary Tree
• Operations in Binary tree
• Recursive and Non Recursive Traversal of Binary/Binary
Search Tree
• In-Order Traversal
• Pre-Order Traversal
• Post-Order Traversal
• Insertion of New Node in BST
• Deletion of a Node from BST
• Searching in a Binary Search Tree
4. Introduction to Tree
• Fundamental data storage structures used in
programming.
• Combines advantages of an ordered array and a
linked list.
• Searching as fast as in ordered array.
• Insertion and deletion as fast as in linked list.
6. Binary Tree
• Any Node can have maximum of two child nodes.
• Each node contains:
▫ A value (some sort of data item)
▫ A reference or pointer to a left child (may be null), and
▫ A reference or pointer to a right child (may be null)
• If not empty, a binary tree has a root node
▫ Every node in the binary tree is reachable from the root
node by a unique path
• A node with neither a left child nor a right child is called a leaf
8. Binary Tree
Strictly Binary Tree (SBT):
▫ Every Node has zero or two nodes.
▫ If (n -> LeafNode)
▫ then N=2n-1
Complete Binary Tree (CBT):
▫ All Leaf Nodes are at the same level.
▫ In CBT height of any leaf node is the height of the tree.
▫ N= 20 + 21 + 22 + 23 + ..… + 2L
9. Binary Tree Operations
Creating a Node:
• The basis of our binary tree node is the following
struct declaration:
9
struct TreeNode
{
int data;
TreeNode *left;
TreeNode *right;
TreeNode *parent
};
TreeNode *P=root;
10. Binary Tree Operations
• Root: if (P->parent==NULL)
• Leaf: if (P->Left==NULL && P->Right==NULL)
• isLeft (P){
▫ If ((P->Parent)->Left==P)
▫ return true; }
• isRight (P){
▫ If ((P->Parent)->Right==P)
▫ return true; }
• isSibling (P,Q){
▫ If ((P->Parent)==(Q->Parent))
▫ return true; }
10
11. 11
Tree Traversals
• A binary tree is defined recursively: it consists of a root, a
left subtree, and a right subtree
• To traverse the binary tree is to visit each node in the
binary tree exactly once
• Since a binary tree has three “parts,” there are six possible
ways to traverse the binary tree:
▫ root, left, right
▫ left, root, right
▫ left, right, root
▫ root, right, left
▫ right, root, left
▫ right, left, root
12. Traversing the Tree
• There are three simple ways to traverse a tree:
▫ Inorder
▫ Preorder
▫ Postorder
• Each of these methods is best implemented as a
recursive function.
13. 13
Inorder Traversing - Algorithm
1. Traverse the left subtree, i.e., call Inorder(left-
subtree)
2. Visit the root.
3. Traverse the right subtree, i.e., call
Inorder(right-subtree)
14. Inorder Traversing
1.The node’s left subtree is
traversed.
2.The node’s data is processed.
3.The node’s right subtree is
traversed.
15. 15
Inorder Traversing - Implementation
• In inorder, the root is visited in the middle
• Here’s an inorder traversal to print out all the
elements in the binary tree:
void inorderPrint(BinaryTree bt) {
inorderPrint(bt.leftChild);
cout<<bt.value;
inorderPrint(bt.rightChild);
}
16. Non Recursive Inorder Traversing
1) Create an empty stack S.
2) Initialize current node as root
3) Push the current node to S and set current = current->left
until current is NULL
4) If current is NULL and stack is not empty then:
a) Pop the top item from stack.
b) Print the popped item, set current = popped_item->right
c) Go to step 3.
5) If current is NULL and stack is empty then we are done.
17. 17
Uses of Inorder
• In case of binary search trees (BST), Inorder
traversal gives nodes in non-decreasing order. To
get nodes of BST in non-increasing order, a
variation of Inorder traversal where Inorder
traversals reversed can be used
18. 18
Preorder Traversing - Algorithm
1. Visit the root.
2. Traverse the left subtree, i.e., call
Preorder(left-subtree)
3. Traverse the right subtree, i.e., call
Preorder(right-subtree)
19. Preorder Traversing
1.The node’s data is processed.
2.The node’s left subtree is
traversed.
3.The node’s right subtree is
traversed.
20. 20
Preorder Traversing - Implementation
• In preorder, the root is visited first
• Here’s a preorder traversal to print out all the
elements in the binary tree:
void preorderPrint(BinaryTree bt) {
cout<<bt.value;
preorderPrint(bt.leftChild);
preorderPrint(bt.rightChild);
}
21. 21
Non Recursive Preorder Traversing
• Create a Stack.
• Print the root and push it to Stack and go left
i.e root=root.left and till it hits the NULL.
• If root is null and Stack is empty then
▫ return, we are done.
• Else
▫ Pop the top Node from the Stack and set it as, root
= popped_Node.
▫ Go right, root = root.right.
▫ Go to step 2.
• End If
22. 22
Uses of Preorder
• Preorder traversal is used to create a copy of the
tree.
• Preorder traversal is also used to get prefix
expression on of an expression tree.
23. 23
Postorder traversal - Algorithm
1. Traverse the left subtree, i.e., call
Postorder(left-subtree)
2. Traverse the right subtree, i.e., call
Postorder(right-subtree)
3. Visit the root.
24. Postorder Traversing
1.The node’s left subtree is
traversed.
2.The node’s right subtree is
traversed.
3.The node’s data is processed.
25. 25
Postorder traversal - Implementation
• In postorder, the root is visited last
• Here’s a postorder traversal to print out all the
elements in the binary tree:
void postorderPrint(BinaryTree bt) {
postorderPrint(bt.leftChild);
postorderPrint(bt.rightChild);
cout<<bt.value;
}
26. 26
Non Recursive Preorder Traversing
• Push root into Stack_One.
• while(Stack_One is not empty)
▫ Pop the node from Stack_One and push it into
Stack_Two.
▫ Push the left and right child nodes of popped node
into Stack_One.
• End Loop
• Pop out all the nodes from Stack_Two and print
it.
27. 27
Uses of Postorder
• Postorder traversal is used to delete the tree.
• Postorder traversal is also useful to get the postfix
expression of an expression tree.
28. Inserting a Node
• Inserting a Node: The idea is to do iterative level
order traversal of the given tree using queue. If
we find a node whose left child is empty, we
make new key as left child of the node. Else if we
find a node whose right child is empty, we make
new key as right child. We keep traversing the
tree until we find a node whose either left or
right is empty.
28
29. Inserting a Node - Algorithm
1. If the root is null:
a) Replace empty tree with a new tree with the item at the
root and return true
2. else if the item is equal to root.data
1. The item is already in the tree; return false
3. else if the item is less than root.data
1. Recursively insert the item in the left subtree
4. else
1. Recursively insert the item in the right subtree
31. Deleting a Node
• While deleting a leaf node we simply find its parent
and set the child pointer that links to it to NULL, and
then free the node's memory.
• But if we are deleting a node that has child nodes
then we must delete the node while at the same
time preserving the subtrees that the node links to.
• There are two possible situations when we are
deleting a non-leaf node:
▫ A) the node has one child, or
▫ B) the node has two children.
31
32. Deleting a Node - Algorithm
1. Starting at root, find the deepest and rightmost
node in binary tree and node which we want to
delete.
2. Replace the deepest rightmost node’s data with
node to be deleted.
3. Then delete the deepest rightmost node.
33. Deleting a Node with one child
33
Figure illustrates a tree in which we are
about to delete a node with one subtree.
34. Deleting a Node with one child
34
Figure shows how we will link the node's
subtree with its parent.
35. Deleting a Node with two children
35
The problem is not as easily solved,
however, when the node we are about
to delete has two subtrees. For example,
look at Figure .
36. Deleting a Node with two children
36
We cannot attach both of the node's subtrees
to its parent, so there must be an alternative
solution.
One way is to attach the node's right subtree
to the parent, and then find a position in the
right subtree to attach the left subtree. The
result is shown in Figure.
37. Deleting a Node
37
To delete a node from the IntBinaryTree, call the public member function
remove. The argument is the value of the node that is to be deleted.
void IntBinaryTree::remove(int num)
{
deleteNode(num, root);
}
The remove member function calls the deleteNode member function. It passes the
value of the node to delete, and the root pointer.
38. 38
Searching the Tree - Algorithm
1. if the root is null:
a) the item is not in the tree; return null
2. Compare the value of target with root.data
3. if they are equal:
a) the target has been found; return the data at the root
4. else if the target is less than root.data:
a) return the result of searching the left subtree
5. else:
a) return the result of searching the right subtree
39. 39
Searching Tree - Performance
• Search a tree is generally O(log n)
• If a tree is not very full, performance will be worse
• Searching a tree with only right subtrees, for example, is O(n)
40. Summary
• Introduction to Binary Tree
• Operations in Binary tree
• Recursive and Non Recursive Traversal of
Binary/Binary Search Tree
• In-Order Traversal
• Pre-Order Traversal
• Post-Order Traversal
• Insertion of New Node in BST
• Deletion of a Node from BST
• Searching in a Binary Search Tree