This document provides an overview of an introductory course on algorithms and data structures. It discusses key topics that will be covered including introduction to algorithms, complexity analysis, algorithm design strategies like divide and conquer, and data structures. Specific examples of algorithms and data structures are provided like sorting, searching, linked lists, stacks, queues, trees and graphs. Implementation tools for algorithms like pseudo code and flowcharts are also introduced.
The document discusses two algorithms for filling polygons: boundary fill and flood fill. Boundary fill starts at a point inside the polygon and fills pixels until it reaches the boundary color. Flood fill replaces all pixels of a specified interior color with a fill color. Both can be implemented with 4-connected or 8-connected pixels. Flood fill colors the entire area but uses more memory, while boundary fill stops at the boundary and is more efficient.
Each node in a doubly linked list contains two pointers - one pointing to the next node and one pointing to the previous node. This allows traversal in both directions through the list. A doubly linked list supports common operations like insertion and deletion at both ends of the list as well as anywhere in the list by updating the relevant pointer fields of the nodes. While requiring more space per node, doubly linked lists allow easy traversal backwards through the list and reversing of the list.
This document discusses deterministic and non-deterministic algorithms. A deterministic algorithm always produces the same output for a given input, while a non-deterministic algorithm may have multiple possible outputs for one input. Non-deterministic algorithms have two stages: a guessing stage that generates a potential solution, and a verification stage that checks if the guess is correct. Examples of non-deterministic algorithms given are a search algorithm that guesses a location containing the search value, and a sorting algorithm that guesses the sorted order of elements.
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
This document discusses analysis of algorithms and time complexity. It explains that analysis of algorithms determines the resources needed to execute algorithms. The time complexity of an algorithm quantifies how long it takes. There are three cases to analyze - worst case, average case, and best case. Common notations for time complexity include O(1), O(n), O(n^2), O(log n), and O(n!). The document provides examples of algorithms and determines their time complexity in different cases. It also discusses how to combine complexities of nested loops and loops in algorithms.
This document discusses the first pass of an assembler. It begins by defining an assembler as a language processor that converts assembly language to machine language. It then describes the different types of assemblers, focusing on single-pass and two-pass assemblers. For two-pass assemblers, it outlines the tasks of the analysis and synthesis phases in the first and second passes respectively. These include separating symbols, building symbol tables, performing label and literal processing, and constructing intermediate code in the first pass and then generating the target program in the second pass. The document provides an example of intermediate code format and walks through converting an example assembly program to intermediate code using the first pass of a two-pass assembler.
The document discusses sorting algorithms. It begins by defining sorting as arranging data in logical order based on a key. It then discusses internal and external sorting methods. For internal sorting, all data fits in memory, while external sorting handles data too large for memory. The document covers stability, efficiency, and time complexity of various sorting algorithms like bubble sort, selection sort, insertion sort, and merge sort. Merge sort uses a divide-and-conquer approach to sort arrays with a time complexity of O(n log n).
A register is a group of flip-flops that can store multiple bits of data. There are four types of shift registers: serial-in serial-out (SISO), serial-in parallel-out (SIPO), parallel-in serial-out (PISO), and parallel-in parallel-out (PIPO). Shift registers allow data to move between flip-flops on each clock pulse. Ring counters and Johnson counters are examples of shift register counters that produce repeating output sequences.
AVL Tree in Data Structures- It is height balanced tree with balance factor 1, -1 or 0. The different type of rotations used in this tree are: RR, LL, RL, LR
The document discusses two algorithms for filling polygons: boundary fill and flood fill. Boundary fill starts at a point inside the polygon and fills pixels until it reaches the boundary color. Flood fill replaces all pixels of a specified interior color with a fill color. Both can be implemented with 4-connected or 8-connected pixels. Flood fill colors the entire area but uses more memory, while boundary fill stops at the boundary and is more efficient.
Each node in a doubly linked list contains two pointers - one pointing to the next node and one pointing to the previous node. This allows traversal in both directions through the list. A doubly linked list supports common operations like insertion and deletion at both ends of the list as well as anywhere in the list by updating the relevant pointer fields of the nodes. While requiring more space per node, doubly linked lists allow easy traversal backwards through the list and reversing of the list.
This document discusses deterministic and non-deterministic algorithms. A deterministic algorithm always produces the same output for a given input, while a non-deterministic algorithm may have multiple possible outputs for one input. Non-deterministic algorithms have two stages: a guessing stage that generates a potential solution, and a verification stage that checks if the guess is correct. Examples of non-deterministic algorithms given are a search algorithm that guesses a location containing the search value, and a sorting algorithm that guesses the sorted order of elements.
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
This document discusses analysis of algorithms and time complexity. It explains that analysis of algorithms determines the resources needed to execute algorithms. The time complexity of an algorithm quantifies how long it takes. There are three cases to analyze - worst case, average case, and best case. Common notations for time complexity include O(1), O(n), O(n^2), O(log n), and O(n!). The document provides examples of algorithms and determines their time complexity in different cases. It also discusses how to combine complexities of nested loops and loops in algorithms.
This document discusses the first pass of an assembler. It begins by defining an assembler as a language processor that converts assembly language to machine language. It then describes the different types of assemblers, focusing on single-pass and two-pass assemblers. For two-pass assemblers, it outlines the tasks of the analysis and synthesis phases in the first and second passes respectively. These include separating symbols, building symbol tables, performing label and literal processing, and constructing intermediate code in the first pass and then generating the target program in the second pass. The document provides an example of intermediate code format and walks through converting an example assembly program to intermediate code using the first pass of a two-pass assembler.
The document discusses sorting algorithms. It begins by defining sorting as arranging data in logical order based on a key. It then discusses internal and external sorting methods. For internal sorting, all data fits in memory, while external sorting handles data too large for memory. The document covers stability, efficiency, and time complexity of various sorting algorithms like bubble sort, selection sort, insertion sort, and merge sort. Merge sort uses a divide-and-conquer approach to sort arrays with a time complexity of O(n log n).
A register is a group of flip-flops that can store multiple bits of data. There are four types of shift registers: serial-in serial-out (SISO), serial-in parallel-out (SIPO), parallel-in serial-out (PISO), and parallel-in parallel-out (PIPO). Shift registers allow data to move between flip-flops on each clock pulse. Ring counters and Johnson counters are examples of shift register counters that produce repeating output sequences.
AVL Tree in Data Structures- It is height balanced tree with balance factor 1, -1 or 0. The different type of rotations used in this tree are: RR, LL, RL, LR
This document discusses different types of sorting algorithms. It describes internal sorting and external sorting, with internal sorting handling all data in memory and external sorting requiring external memory. Bubble sort, selection sort, and insertion sort are briefly explained as examples of sorting methods. Bubble sort works by comparing adjacent elements and swapping if out of order, selection sort finds the minimum element and selection sort inserts elements into the sorted position. Pseudocode and examples are provided for each algorithm.
This document discusses arrays and operations on arrays. It defines an array as a fixed collection of homogeneous data items stored in contiguous memory locations and indexed by integers. It describes the insert operation as shifting existing elements over and adding the new element at the specified index. It also describes the delete operation as shifting elements back and overwriting the element at the specified index.
The document discusses the accumulator register in a CPU. It describes the accumulator as a short-term storage register for arithmetic and logic operations. It contains details about the inputs and outputs to the accumulator from other registers like the data register and input register. It also explains the different microoperations that can be performed on the accumulator like addition, transfer, complement, and shift operations. The control gates for these microoperations are also defined.
This document discusses different addressing modes used in computer architecture. It defines 10 addressing modes: immediate, register, register indirect, direct, indirect, implied, relative, indexed, base register, and autoincrement/autodecrement. Each addressing mode is described in terms of how the operand is specified and accessed from memory or registers. Examples are provided to illustrate each addressing mode.
Sparse matrix and its representation data structureVardhil Patel
The document discusses sparse matrices and their efficient representation. It defines a sparse matrix as one with very few non-zero elements, so representing it as a standard 2D array wastes space storing many zero values. More efficient representations of sparse matrices include storing only the non-zero elements and their indices in a triplet format, or using a linked list structure with one list per row containing (column, value) node pairs. Examples of each approach are provided.
This document discusses different searching methods like sequential, binary, and hashing. It defines searching as finding an element within a list. Sequential search searches lists sequentially until the element is found or the end is reached, with efficiency of O(n) in worst case. Binary search works on sorted arrays by eliminating half of remaining elements at each step, with efficiency of O(log n). Hashing maps keys to table positions using a hash function, allowing searches, inserts and deletes in O(1) time on average. Good hash functions uniformly distribute keys and generate different hashes for similar keys.
This document discusses the complexity of algorithms and the tradeoff between algorithm cost and time. It defines algorithm complexity as a function of input size that measures the time and space used by an algorithm. Different complexity classes are described such as polynomial, sub-linear, and exponential time. Examples are given to find the complexity of bubble sort and linear search algorithms. The concept of space-time tradeoffs is introduced, where using more space can reduce computation time. Genetic algorithms are proposed to efficiently solve large-scale construction time-cost tradeoff problems.
The document discusses algorithms and their complexity. It defines an algorithm as a well-defined computational procedure that takes inputs and produces outputs. Algorithms have properties like definiteness, correctness, finiteness, and effectiveness. While faster computers make any method viable, analyzing algorithms' complexity is still important because computing resources are finite. Algorithm complexity is analyzed asymptotically for large inputs, focusing on growth rates like constant, logarithmic, linear, quadratic, and exponential. Common notations like Big-O describe upper algorithm complexity bounds.
Register transfer language & its micro operationsLakshya Sharma
The document discusses register transfer language and micro-operations in digital systems. It describes (1) how register transfer language can be used to describe the sequence of micro-operations involved in any computer function, (2) the four main types of micro-operations - register transfer, arithmetic, logic, and shift micro-operations, giving examples of each, and (3) how register transfers and bus transfers are represented in register transfer language.
The document discusses different types of queues including their representations, operations, and applications. It describes queues as linear data structures that follow a first-in, first-out principle. Common queue operations are insertion at the rear and deletion at the front. Queues can be represented using arrays or linked lists. Circular queues and priority queues are also described as variants that address limitations of standard queues. Real-world and technical applications of queues include CPU scheduling, cashier lines, and data transfer between processes.
A presentation on the topic of BCD arithmetic and 16-bit data operations of the subject Microprocessor and interfacing MI/MPI, useful especially for GTU students.
Introduction to design and analysis of algorithmDevaKumari Vijay
This document defines algorithms and describes how to analyze their efficiency. It states that an algorithm is a set of unambiguous instructions that accepts input and produces output within a finite number of steps. The document outlines criteria algorithms must satisfy like being definite, finite, and effective. It also describes different representations of algorithms like pseudocode and flowcharts. The document then discusses analyzing algorithms' time and space efficiency using asymptotic notations like Big-O, Big-Omega, and Big-Theta. It defines these notations and provides examples to classify algorithms' order of growth.
Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(Log n).
Design and Analysis of Algorithm help to design the algorithms for solving different types of problems in Computer Science. It also helps to design and analyze the logic of how the program will work before developing the actual code for a program.
The document provides an overview of assembly language programming for the 8085 microprocessor. It discusses the 8085 programming model including registers, flags, and addressing modes. It also describes the instruction set categories and provides examples of common instruction types like data transfer, arithmetic, logical, and branching instructions. Sample assembly language programs are shown to add two numbers and handle results larger than 8 bits.
The document discusses algorithms and data structures, focusing on binary search trees (BSTs). It provides the following key points:
- BSTs are an important data structure for dynamic sets that can perform operations like search, insert, and delete in O(h) time where h is the height of the tree.
- Each node in a BST contains a key, and pointers to its left/right children and parent. The keys must satisfy the BST property - all keys in the left subtree are less than the node's key, and all keys in the right subtree are greater.
- Rotations are a basic operation used to restructure trees during insertions/deletions. They involve reassigning child
Here are the answers:
1. b. Merge sort is generally more efficient than bubble sort.
2. c. Both quick sort and merge sort use a divide and conquer strategy.
3. b. Pivot element is used in quick sort.
4. b. Quick sort is generally considered the fastest sorting algorithm in practice.
5. c. The quick sort is faster than merge sort.
The document discusses algorithms and data structures. It defines an algorithm as a step-by-step procedure for solving a problem using a computer in a finite number of steps. It categorizes common types of algorithms as search, sort, insert, update, and delete algorithms. The document also defines a data structure as a way to store and organize data for efficient use. It distinguishes between linear and non-linear as well as static and dynamic data structures. Finally, it discusses algorithm design strategies like divide and conquer, merge sort, and dynamic programming.
This document describes a course on data structures and algorithms. The course covers fundamental algorithms like sorting and searching as well as data structures including arrays, linked lists, stacks, queues, trees, and graphs. Students will learn to analyze algorithms for efficiency, apply techniques like recursion and induction, and complete programming assignments implementing various data structures and algorithms. The course aims to enhance students' skills in algorithm design, implementation, and complexity analysis. It is worth 4 credits and has prerequisites in computer programming. Student work will be graded based on assignments, exams, attendance, and a final exam.
This document discusses different types of sorting algorithms. It describes internal sorting and external sorting, with internal sorting handling all data in memory and external sorting requiring external memory. Bubble sort, selection sort, and insertion sort are briefly explained as examples of sorting methods. Bubble sort works by comparing adjacent elements and swapping if out of order, selection sort finds the minimum element and selection sort inserts elements into the sorted position. Pseudocode and examples are provided for each algorithm.
This document discusses arrays and operations on arrays. It defines an array as a fixed collection of homogeneous data items stored in contiguous memory locations and indexed by integers. It describes the insert operation as shifting existing elements over and adding the new element at the specified index. It also describes the delete operation as shifting elements back and overwriting the element at the specified index.
The document discusses the accumulator register in a CPU. It describes the accumulator as a short-term storage register for arithmetic and logic operations. It contains details about the inputs and outputs to the accumulator from other registers like the data register and input register. It also explains the different microoperations that can be performed on the accumulator like addition, transfer, complement, and shift operations. The control gates for these microoperations are also defined.
This document discusses different addressing modes used in computer architecture. It defines 10 addressing modes: immediate, register, register indirect, direct, indirect, implied, relative, indexed, base register, and autoincrement/autodecrement. Each addressing mode is described in terms of how the operand is specified and accessed from memory or registers. Examples are provided to illustrate each addressing mode.
Sparse matrix and its representation data structureVardhil Patel
The document discusses sparse matrices and their efficient representation. It defines a sparse matrix as one with very few non-zero elements, so representing it as a standard 2D array wastes space storing many zero values. More efficient representations of sparse matrices include storing only the non-zero elements and their indices in a triplet format, or using a linked list structure with one list per row containing (column, value) node pairs. Examples of each approach are provided.
This document discusses different searching methods like sequential, binary, and hashing. It defines searching as finding an element within a list. Sequential search searches lists sequentially until the element is found or the end is reached, with efficiency of O(n) in worst case. Binary search works on sorted arrays by eliminating half of remaining elements at each step, with efficiency of O(log n). Hashing maps keys to table positions using a hash function, allowing searches, inserts and deletes in O(1) time on average. Good hash functions uniformly distribute keys and generate different hashes for similar keys.
This document discusses the complexity of algorithms and the tradeoff between algorithm cost and time. It defines algorithm complexity as a function of input size that measures the time and space used by an algorithm. Different complexity classes are described such as polynomial, sub-linear, and exponential time. Examples are given to find the complexity of bubble sort and linear search algorithms. The concept of space-time tradeoffs is introduced, where using more space can reduce computation time. Genetic algorithms are proposed to efficiently solve large-scale construction time-cost tradeoff problems.
The document discusses algorithms and their complexity. It defines an algorithm as a well-defined computational procedure that takes inputs and produces outputs. Algorithms have properties like definiteness, correctness, finiteness, and effectiveness. While faster computers make any method viable, analyzing algorithms' complexity is still important because computing resources are finite. Algorithm complexity is analyzed asymptotically for large inputs, focusing on growth rates like constant, logarithmic, linear, quadratic, and exponential. Common notations like Big-O describe upper algorithm complexity bounds.
Register transfer language & its micro operationsLakshya Sharma
The document discusses register transfer language and micro-operations in digital systems. It describes (1) how register transfer language can be used to describe the sequence of micro-operations involved in any computer function, (2) the four main types of micro-operations - register transfer, arithmetic, logic, and shift micro-operations, giving examples of each, and (3) how register transfers and bus transfers are represented in register transfer language.
The document discusses different types of queues including their representations, operations, and applications. It describes queues as linear data structures that follow a first-in, first-out principle. Common queue operations are insertion at the rear and deletion at the front. Queues can be represented using arrays or linked lists. Circular queues and priority queues are also described as variants that address limitations of standard queues. Real-world and technical applications of queues include CPU scheduling, cashier lines, and data transfer between processes.
A presentation on the topic of BCD arithmetic and 16-bit data operations of the subject Microprocessor and interfacing MI/MPI, useful especially for GTU students.
Introduction to design and analysis of algorithmDevaKumari Vijay
This document defines algorithms and describes how to analyze their efficiency. It states that an algorithm is a set of unambiguous instructions that accepts input and produces output within a finite number of steps. The document outlines criteria algorithms must satisfy like being definite, finite, and effective. It also describes different representations of algorithms like pseudocode and flowcharts. The document then discusses analyzing algorithms' time and space efficiency using asymptotic notations like Big-O, Big-Omega, and Big-Theta. It defines these notations and provides examples to classify algorithms' order of growth.
Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(Log n).
Design and Analysis of Algorithm help to design the algorithms for solving different types of problems in Computer Science. It also helps to design and analyze the logic of how the program will work before developing the actual code for a program.
The document provides an overview of assembly language programming for the 8085 microprocessor. It discusses the 8085 programming model including registers, flags, and addressing modes. It also describes the instruction set categories and provides examples of common instruction types like data transfer, arithmetic, logical, and branching instructions. Sample assembly language programs are shown to add two numbers and handle results larger than 8 bits.
The document discusses algorithms and data structures, focusing on binary search trees (BSTs). It provides the following key points:
- BSTs are an important data structure for dynamic sets that can perform operations like search, insert, and delete in O(h) time where h is the height of the tree.
- Each node in a BST contains a key, and pointers to its left/right children and parent. The keys must satisfy the BST property - all keys in the left subtree are less than the node's key, and all keys in the right subtree are greater.
- Rotations are a basic operation used to restructure trees during insertions/deletions. They involve reassigning child
Here are the answers:
1. b. Merge sort is generally more efficient than bubble sort.
2. c. Both quick sort and merge sort use a divide and conquer strategy.
3. b. Pivot element is used in quick sort.
4. b. Quick sort is generally considered the fastest sorting algorithm in practice.
5. c. The quick sort is faster than merge sort.
The document discusses algorithms and data structures. It defines an algorithm as a step-by-step procedure for solving a problem using a computer in a finite number of steps. It categorizes common types of algorithms as search, sort, insert, update, and delete algorithms. The document also defines a data structure as a way to store and organize data for efficient use. It distinguishes between linear and non-linear as well as static and dynamic data structures. Finally, it discusses algorithm design strategies like divide and conquer, merge sort, and dynamic programming.
This document describes a course on data structures and algorithms. The course covers fundamental algorithms like sorting and searching as well as data structures including arrays, linked lists, stacks, queues, trees, and graphs. Students will learn to analyze algorithms for efficiency, apply techniques like recursion and induction, and complete programming assignments implementing various data structures and algorithms. The course aims to enhance students' skills in algorithm design, implementation, and complexity analysis. It is worth 4 credits and has prerequisites in computer programming. Student work will be graded based on assignments, exams, attendance, and a final exam.
This document provides an overview of a course on data structures and algorithm analysis. It introduces some key data structures like arrays, linked lists, stacks, and queues. It also discusses algorithm strategies such as brute force, greedy, and divide-and-conquer algorithms. The course contents are described, including reviewing programming concepts, fundamental data structures and algorithms, recursion, and more. Assessment includes assignments, quizzes, class tests, and a final exam. Common operations on data structures like traversal, insertion, deletion, and searching are explained.
This document provides an introduction to data structures and algorithms. It discusses why they are important for programming and problem solving. It defines key concepts like abstract data types, data structures, algorithms, and algorithm analysis. It also covers different ways of classifying data structures and analyzing the time and space complexity of algorithms. The goal is to help students understand fundamental concepts around organizing data and designing efficient computational procedures.
This document introduces key concepts related to data structures and algorithms. It defines objectives like introducing commonly used data structures and selecting the best one for a given problem. It describes how abstraction is used to model problems and define abstract data types independently of programming languages. Data structures provide a physical implementation of abstract data types by organizing data in memory. Algorithms manipulate data structures to transform their state and produce outputs. Properties like finiteness, definiteness, correctness, and efficiency are discussed for algorithms. Measuring an algorithm's theoretical efficiency using asymptotic analysis is introduced.
The document provides biographical and professional details about Engr. Dr. Sohaib Manzoor. It lists his educational qualifications including a BS in electrical engineering, an MS in electrical and electronics engineering, and a PhD in information and communication engineering. It also outlines his work experience as a lecturer at Mirpur University of Science and Technology, Pakistan. Additionally, it lists his skills, contact information, hobbies and some academic and non-academic achievements.
This document provides an introduction to data structures and algorithms. It defines key concepts such as data structures, abstract data types, abstraction, and algorithms. Data structures are used to organize data in memory to solve problems, while algorithms are the step-by-step processes used to manipulate data structures. Programs consist of both data structures and algorithms. The document also outlines properties that algorithms must have such as being finite, definite, sequential, feasible, correct, independent of language, complete, effective, and having specified input/output.
The document discusses algorithms and data structures. It begins by introducing common data structures like arrays, stacks, queues, trees, and hash tables. It then explains that data structures allow for organizing data in a way that can be efficiently processed and accessed. The document concludes by stating that the choice of data structure depends on effectively representing real-world relationships while allowing simple processing of the data.
Data may be organized in many different ways; the logical or mathematical model of a particular organization of data is called "Data Structure". The choice of a particular data model depends on two considerations:
It must be rich enough in structure to reflect the actual relationships of the data in the real world.
The structure should be simple enough that one can effectively process the data when necessary.
Data Structure Operations
The particular data structure that one chooses for a given situation depends largely on the nature of specific operations to be performed.
The following are the four major operations associated with any data structure:
i. Traversing : Accessing each record exactly once so that certain items in the record may be processed.
ii. Searching : Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions.
iii. Inserting : Adding a new record to the structure.
iv. Deleting : Removing a record from the structure.
Primitive and Composite Data Types
Primitive Data Types are Basic data types of any language. In most computers these are native to the machine's hardware.
Some Primitive data types are:
Integer
This document provides an overview of a course on data structures and algorithms. The course covers fundamental data structures like arrays, stacks, queues, lists, trees, hashing, and graphs. It emphasizes good programming practices like modularity, documentation and readability. Key concepts covered include data types, abstract data types, algorithms, selecting appropriate data structures based on efficiency requirements, and the goals of learning commonly used structures and analyzing structure costs and benefits.
In this educational video, we will provide an introduction to data structures. You will learn what data structures are, including queues, stacks, trees, and binary search. We will explore different types of data structures and specifically dive into priority queues. By watching this ppt, you will gain knowledge and have the opportunity to improve your command of data structures. Don't miss this chance to learn something new and expand your understanding.
The document discusses data structures and their importance in organizing data efficiently for computer programs. It defines what a data structure is and how choosing the right one can improve a program's performance. Several examples are provided to illustrate how analyzing a problem's specific needs guides the selection of an optimal data structure.
The document discusses data structures and their importance in organizing data efficiently for computer programs. It defines what a data structure is and how choosing the right one can improve a program's performance. Several examples are provided to illustrate how analyzing a problem's specific needs guides the selection of an optimal data structure.
This document provides an introduction to algorithms and data structures. It defines key terms like data, data types, data structures, algorithms, complexity analysis, and common algorithm design strategies. Linear and non-linear data structures are described, as are static and dynamic data structures. Examples of common algorithms like sorting, searching and graph algorithms are provided. Complexity analysis techniques like Big O notation are introduced to analyze algorithms. Problem-solving techniques like divide-and-conquer and greedy algorithms are summarized along with examples like minimum spanning trees.
part 1 - intorduction data structure 2021 mte.pptabdoSelem1
The document outlines a course on data structures and algorithms that is divided into 6 main parts covering various data structures, algorithms for sorting and searching, and programming concepts. The objectives of the course are to familiarize students with data structures, algorithms, and analyzing algorithm efficiency. Assessment will be based on assignments, projects, exams, and class participation.
Chapter 1 Introduction to Data Structures and Algorithms.pdfAxmedcarb
Data structures provide an efficient way to store and organize data in a computer so that it can be used efficiently. They allow programmers to handle data in an enhanced way, improving software performance. There are linear data structures like arrays and linked lists, and non-linear structures like trees and graphs. Common operations on data structures include insertion, deletion, searching, sorting, and merging. Asymptotic analysis is used to define the time complexity of algorithms in the average, best, and worst cases.
This document provides information about an algorithms course, including the course syllabus and topics that will be covered. The course topics include introduction to algorithms, analysis of algorithms, algorithm design techniques like divide and conquer, greedy algorithms, dynamic programming, backtracking, and branch and bound. It also covers NP-hard and NP-complete problems. The syllabus outlines 5 units that will analyze performance, teach algorithm design methods, and solve problems using techniques like divide and conquer, dynamic programming, and backtracking. It aims to help students choose appropriate algorithms and data structures for applications and understand how algorithm design impacts program performance.
A data structure is a storage that is used to store and organize data. It is a way of arranging data on a computer so that it can be accessed and updated efficiently. A data structure is not only used for organizing the data. It is also used for processing, retrieving, and storing data. That entire data can be represented using an object and can be used throughout the program.
This document provides lecture notes on data structures that cover key topics including:
- Classifying data structures as simple, compound, linear, and non-linear and providing examples.
- Defining abstract data types and algorithms, and explaining their structure and properties.
- Discussing approaches for designing algorithms and issues related to time and space complexity.
- Covering searching techniques like linear search and sorting techniques including bubble sort, selection sort, and quick sort.
- Describing linear data structures like stacks, queues, and linked lists and non-linear structures like trees and graphs.
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...shadow0702a
This document serves as a comprehensive step-by-step guide on how to effectively use PyCharm for remote debugging of the Windows Subsystem for Linux (WSL) on a local Windows machine. It meticulously outlines several critical steps in the process, starting with the crucial task of enabling permissions, followed by the installation and configuration of WSL.
The guide then proceeds to explain how to set up the SSH service within the WSL environment, an integral part of the process. Alongside this, it also provides detailed instructions on how to modify the inbound rules of the Windows firewall to facilitate the process, ensuring that there are no connectivity issues that could potentially hinder the debugging process.
The document further emphasizes on the importance of checking the connection between the Windows and WSL environments, providing instructions on how to ensure that the connection is optimal and ready for remote debugging.
It also offers an in-depth guide on how to configure the WSL interpreter and files within the PyCharm environment. This is essential for ensuring that the debugging process is set up correctly and that the program can be run effectively within the WSL terminal.
Additionally, the document provides guidance on how to set up breakpoints for debugging, a fundamental aspect of the debugging process which allows the developer to stop the execution of their code at certain points and inspect their program at those stages.
Finally, the document concludes by providing a link to a reference blog. This blog offers additional information and guidance on configuring the remote Python interpreter in PyCharm, providing the reader with a well-rounded understanding of the process.
Generative AI Use cases applications solutions and implementation.pdfmahaffeycheryld
Generative AI solutions encompass a range of capabilities from content creation to complex problem-solving across industries. Implementing generative AI involves identifying specific business needs, developing tailored AI models using techniques like GANs and VAEs, and integrating these models into existing workflows. Data quality and continuous model refinement are crucial for effective implementation. Businesses must also consider ethical implications and ensure transparency in AI decision-making. Generative AI's implementation aims to enhance efficiency, creativity, and innovation by leveraging autonomous generation and sophisticated learning algorithms to meet diverse business challenges.
https://www.leewayhertz.com/generative-ai-use-cases-and-applications/
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELijaia
As digital technology becomes more deeply embedded in power systems, protecting the communication
networks of Smart Grids (SG) has emerged as a critical concern. Distributed Network Protocol 3 (DNP3)
represents a multi-tiered application layer protocol extensively utilized in Supervisory Control and Data
Acquisition (SCADA)-based smart grids to facilitate real-time data gathering and control functionalities.
Robust Intrusion Detection Systems (IDS) are necessary for early threat detection and mitigation because
of the interconnection of these networks, which makes them vulnerable to a variety of cyberattacks. To
solve this issue, this paper develops a hybrid Deep Learning (DL) model specifically designed for intrusion
detection in smart grids. The proposed approach is a combination of the Convolutional Neural Network
(CNN) and the Long-Short-Term Memory algorithms (LSTM). We employed a recent intrusion detection
dataset (DNP3), which focuses on unauthorized commands and Denial of Service (DoS) cyberattacks, to
train and test our model. The results of our experiments show that our CNN-LSTM method is much better
at finding smart grid intrusions than other deep learning algorithms used for classification. In addition,
our proposed approach improves accuracy, precision, recall, and F1 score, achieving a high detection
accuracy rate of 99.50%.
Rainfall intensity duration frequency curve statistical analysis and modeling...bijceesjournal
Using data from 41 years in Patna’ India’ the study’s goal is to analyze the trends of how often it rains on a weekly, seasonal, and annual basis (1981−2020). First, utilizing the intensity-duration-frequency (IDF) curve and the relationship by statistically analyzing rainfall’ the historical rainfall data set for Patna’ India’ during a 41 year period (1981−2020), was evaluated for its quality. Changes in the hydrologic cycle as a result of increased greenhouse gas emissions are expected to induce variations in the intensity, length, and frequency of precipitation events. One strategy to lessen vulnerability is to quantify probable changes and adapt to them. Techniques such as log-normal, normal, and Gumbel are used (EV-I). Distributions were created with durations of 1, 2, 3, 6, and 24 h and return times of 2, 5, 10, 25, and 100 years. There were also mathematical correlations discovered between rainfall and recurrence interval.
Findings: Based on findings, the Gumbel approach produced the highest intensity values, whereas the other approaches produced values that were close to each other. The data indicates that 461.9 mm of rain fell during the monsoon season’s 301st week. However, it was found that the 29th week had the greatest average rainfall, 92.6 mm. With 952.6 mm on average, the monsoon season saw the highest rainfall. Calculations revealed that the yearly rainfall averaged 1171.1 mm. Using Weibull’s method, the study was subsequently expanded to examine rainfall distribution at different recurrence intervals of 2, 5, 10, and 25 years. Rainfall and recurrence interval mathematical correlations were also developed. Further regression analysis revealed that short wave irrigation, wind direction, wind speed, pressure, relative humidity, and temperature all had a substantial influence on rainfall.
Originality and value: The results of the rainfall IDF curves can provide useful information to policymakers in making appropriate decisions in managing and minimizing floods in the study area.
Comparative analysis between traditional aquaponics and reconstructed aquapon...bijceesjournal
The aquaponic system of planting is a method that does not require soil usage. It is a method that only needs water, fish, lava rocks (a substitute for soil), and plants. Aquaponic systems are sustainable and environmentally friendly. Its use not only helps to plant in small spaces but also helps reduce artificial chemical use and minimizes excess water use, as aquaponics consumes 90% less water than soil-based gardening. The study applied a descriptive and experimental design to assess and compare conventional and reconstructed aquaponic methods for reproducing tomatoes. The researchers created an observation checklist to determine the significant factors of the study. The study aims to determine the significant difference between traditional aquaponics and reconstructed aquaponics systems propagating tomatoes in terms of height, weight, girth, and number of fruits. The reconstructed aquaponics system’s higher growth yield results in a much more nourished crop than the traditional aquaponics system. It is superior in its number of fruits, height, weight, and girth measurement. Moreover, the reconstructed aquaponics system is proven to eliminate all the hindrances present in the traditional aquaponics system, which are overcrowding of fish, algae growth, pest problems, contaminated water, and dead fish.
Build the Next Generation of Apps with the Einstein 1 Platform.
Rejoignez Philippe Ozil pour une session de workshops qui vous guidera à travers les détails de la plateforme Einstein 1, l'importance des données pour la création d'applications d'intelligence artificielle et les différents outils et technologies que Salesforce propose pour vous apporter tous les bénéfices de l'IA.
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...IJECEIAES
Medical image analysis has witnessed significant advancements with deep learning techniques. In the domain of brain tumor segmentation, the ability to
precisely delineate tumor boundaries from magnetic resonance imaging (MRI)
scans holds profound implications for diagnosis. This study presents an ensemble convolutional neural network (CNN) with transfer learning, integrating
the state-of-the-art Deeplabv3+ architecture with the ResNet18 backbone. The
model is rigorously trained and evaluated, exhibiting remarkable performance
metrics, including an impressive global accuracy of 99.286%, a high-class accuracy of 82.191%, a mean intersection over union (IoU) of 79.900%, a weighted
IoU of 98.620%, and a Boundary F1 (BF) score of 83.303%. Notably, a detailed comparative analysis with existing methods showcases the superiority of
our proposed model. These findings underscore the model’s competence in precise brain tumor localization, underscoring its potential to revolutionize medical
image analysis and enhance healthcare outcomes. This research paves the way
for future exploration and optimization of advanced CNN models in medical
imaging, emphasizing addressing false positives and resource efficiency.
Design and optimization of ion propulsion dronebjmsejournal
Electric propulsion technology is widely used in many kinds of vehicles in recent years, and aircrafts are no exception. Technically, UAVs are electrically propelled but tend to produce a significant amount of noise and vibrations. Ion propulsion technology for drones is a potential solution to this problem. Ion propulsion technology is proven to be feasible in the earth’s atmosphere. The study presented in this article shows the design of EHD thrusters and power supply for ion propulsion drones along with performance optimization of high-voltage power supply for endurance in earth’s atmosphere.
Gas agency management system project report.pdfKamal Acharya
The project entitled "Gas Agency" is done to make the manual process easier by making it a computerized system for billing and maintaining stock. The Gas Agencies get the order request through phone calls or by personal from their customers and deliver the gas cylinders to their address based on their demand and previous delivery date. This process is made computerized and the customer's name, address and stock details are stored in a database. Based on this the billing for a customer is made simple and easier, since a customer order for gas can be accepted only after completing a certain period from the previous delivery. This can be calculated and billed easily through this. There are two types of delivery like domestic purpose use delivery and commercial purpose use delivery. The bill rate and capacity differs for both. This can be easily maintained and charged accordingly.
Applications of artificial Intelligence in Mechanical Engineering.pdfAtif Razi
Historically, mechanical engineering has relied heavily on human expertise and empirical methods to solve complex problems. With the introduction of computer-aided design (CAD) and finite element analysis (FEA), the field took its first steps towards digitization. These tools allowed engineers to simulate and analyze mechanical systems with greater accuracy and efficiency. However, the sheer volume of data generated by modern engineering systems and the increasing complexity of these systems have necessitated more advanced analytical tools, paving the way for AI.
AI offers the capability to process vast amounts of data, identify patterns, and make predictions with a level of speed and accuracy unattainable by traditional methods. This has profound implications for mechanical engineering, enabling more efficient design processes, predictive maintenance strategies, and optimized manufacturing operations. AI-driven tools can learn from historical data, adapt to new information, and continuously improve their performance, making them invaluable in tackling the multifaceted challenges of modern mechanical engineering.
2. Introduction: From Problem to Program (Problem, Solution,
Algorithm, Data Structure and Program).
Data Structures: Data, Information, Knowledge, and Data structure,
Abstract Data Types (ADT), Data Structure Classification (Linear and
Static and Dynamic, Persistent and Ephemeral data
Non-linear,
structures)
Algorithms: Problem Solving, Introduction to algorithm,
Characteristics of algorithm, Algorithm design tools: Pseudo-code and
flowchart.
Complexity of algorithm: Space complexity, Time complexity,
Asymptotic notation- Big-O, Theta and Omega, finding complexity
using step count method, Analysis of programming constructs-Linear,
Quadratic, Cubic, Logarithmic.
Algorithmic Strategies: Introduction to algorithm design strategies-
Divide and Conquer, and Greedy strategy.
SYLLABUS
4. Computer : A programmable device that can store, retrieve,
and process data.(Combination of H/w & S/w )
Hardware : things which we can touch.
Software : things which we cannt touch.(Can only see)
Programming: A programming language is a set of
commands, instructions, and other syntax use to create a
software program.
Data : Information in a form a computer can use
Information : Any knowledge that can be communicated
Introduction
5. Data type : The specification of how information is represented
in the computer as data and the set of operations that can be
applied to it Computer
Computer program : Data type specifications and instructions
for carrying out operations that are used by a computer to solve
a problem
Introduction
6. Machine language : The language, made up of
binarycoded instructions, that is used directly by the
computer
Assembly language : A low-level programming language
in which a mnemonic is used to represent each of the
machine language instructions for a particular computer
Assembler : A program that translates an assembly
language program into machine code
Introduction
7. Source code : Data type specifications and instructions
written in a high-level programming language
Object code : A machine language version of source
code.
Introduction
Compiler : A program that translates a program written
in a high-level language into machine code
9. DATA STRUCTURE
Data Structure is a way to store and
organize data so that it can be used efficiently.
Data :
“Data is nothing but collection of information i.e.
facts or figures.”
Data Object :
of storage that
“Data object is a region
contains a value or group of value”
10. NEED OF DATA STRUCTURE
1. Stores huge data
2. Stores data in systematic way
3. Retains logical relationship
4. Provides various structure
5. Static and dynamic formats
6. Better algorithms
11. ABSTRACT DATA TYPE
ADT :
“Abstract data types are mathematical models of a set
of data values or information that share similar behavior or qualities and
that can be specified and identified independent of specific
implementations. Abstract data types, or ADTs, are typically used in
algorithms.”
Another definition ofADT is
ADT is set of D, F andA.
D – domain = Data object
F – function = set of operation which cannt carried out on data object.
A– axioms = Properties and rule of the operation
12. TYPES OF DATA STRUCTURE
There are two types :
1. Primitives data structure
2. Non-primitive data structure
13. TYPES OF DATA STRUCTURE
1. Primitives data structure :
“Primitive data structures are those which are predefined way of
storing data by the system. ”
e.g. int, char, float etc
2. Non-primitive data structure :
“The data types that are derived from primary data types are known
as non-Primitive data types. These datatype are used to store group of
values.”
e.g. struct, array, linklist, stack, tree , graph etc.
14. Linear and Non-Linear Data
Structure
1. Linear Data Strucute :
“Linear data structuretraverses the data elements
sequentially, in which only one data element can directly be
reached”
Ex: Arrays, Linked Lists, stack, queue.
2. Non-Linear Data Strucute :
“Every data item is attached to several other data items in a
way that is specific for reflecting relationships.”
Ex: Graph , Tree
16. Static and Dynamic
Data Structure
1. Static data strucure :
“A static data structure is an organization or collection
of data in memory that is fixed in size.”
Ex: Arrays
2. Dynamic Data Strucute :
“ In Dynamic data structure the size of the structure in not
fixed and can be modified during the operations performed on it”
Ex: Linked list
17. Persistent and Ephemeral
Data Structure
1. Persistent data strucure :
“A persistent data structure is a data structure that
always preserves the previous version of itself when it is
modified..”
Ex: Linked list, tree
2. Ephemeral Data Strucute :
“ An ephemeral data structure is one of which only one
version is available at a time(it does not preserve previous
version).”
Ex: RAM , Cache memory
18. Relationship among Data, Data
Structure and Algorithms
Data is considered as set of facts and figures or data is value of
group of value which is in particular format.
Data structure is method of gathering as well as organizing data
in such manner that several operation can be performed
Problem is defined as a situation or condition which need to
solve to achieve the goals
Algorithm is set of ordered instruction which are written in
simple english language.
20. ALGORITHM – PROBLEM SOLVING
COMPUTER :
“Computer is multi purpose Electronic Machine which is
used for storing , organizing and processing data by set of
program
Problem :
“Problem is defined as situation or condition which needs
to solve to achive goal”
Steps in Problem Solving :
1. Define the problem
2. Data gathering
3. Decide effective solution
4. Implement and evaluate the solution
5. Review the result.
21. PROBLEM SOLVING TECHNIQUES
There are two types :
1. Algorithmic
2. Flowchart
Algorithms is set of instructions which are writeen in simple
english language.
Flowchart is graphical representation of the algorithms.
22. Some other Problem Solving
Techniques
1. Trial and error techniques
2. Divide and conquer techniques
3. Merging solution
4. The building block approach
5. Brain storming techniques
23. INTRODUCTION OF ALGORITHMS
DEFINITION :
“An algorithm is defined as a step-by-step procedure or method for
solving a problem by a computer in a finite number of steps.”
From the data structure point of view, following are some important
categories of algorithms −
Search − Algorithm to search an item in a data structure.
Sort − Algorithm to sort items in a certain order.
Insert − Algorithm to insert item in a data structure.
Update − Algorithm to update an existing item in a data structure.
Delete − Algorithm to delete an existing item from a data structure.
24. CHARACTRISTICS OF ALGORITHM
1.Unambiguous − Algorithm should be clear and unambiguous. Each of
its steps (or phases), and their inputs/outputs should be clear and must
lead to only one meaning.
2. Input −An algorithm should have 0 or more well-defined inputs.
3.Output −An algorithm should have 1 or more well-defined outputs,
and should match the desired output.
4. Finiteness −Algorithms must terminate after a finite number of steps.
5. Feasibility − Should be feasible with the available resources.
6.Independent −An algorithm should have step-by-step directions,
which should be independent of any programming code.
25. EXAMPLE OF ALGORITHM
Example
Let's try to learn algorithm-writing by using an example.
Problem − Design an algorithm to add two numbers and display the result.
Step 1 − START
Step 2 − declare three integers a, b & c
Step 3 − define values of a & b
Step 4 − add values of a & b
Step 5 − store output of step 4 to c
Step 6 − print c
Step 7 − STOP
26. ALGORITHM DESIGN TOOL
• There can be two tools :
1. Flowchart
2. Pseudo Code
Flowchart :
“ Flowchart is graphical representation of the algorithms”
Pseudo Code :
“It is simply an implementation of an algorithm in the form of
annotations and informative text written in plain English.
Prof. Anand Gharu
31. EXAMPLE FOR ALGORITH & FLOWCHART
Step1: Start
Step2: Initialize the count variable to zero
Step3: Initialize the sum variable to zero
Step4: Read a number say x
Step 5:Add 1 to the number in the count variable
Step6:Add the number x to the sum variable.
Step7: Is the count variable in the memory greater than
If
50? If yes, display the sum: go to step 8.
No, Repeat from step 4
Step8: Stop
32. Design an algorithm and flowchart to input
fifty numbers and calculate their sum.
35. DIFFERENT APPROCHES TO DESIGN ALGORITHMS
Types of approach :
1. Top down approach
2. Bottom up approach
TOP DOWN APPROACH BOTTOM UP APPROACH
1. Larger problem divided into smaller Smaller pieces are combined together
2. Execution Start from top to down Execution start from bottom to top
3. C is top down approach language C++ is bottom up approach language
4. Main() is written at beginning Main() is written at end of program
37. ALGORITHM ANALYSIS
• A Priori Analysis − This is a theoretical analysis of an algorithm.
Efficiency of an algorithm is measured by assuming that all other
factors, for example, processor speed, are constant and have no
effect on the implementation.
• A Posterior Analysis − This is an empirical analysis of an
algorithm. The selected algorithm is implemented using
programming language. This is then executed on target computer
machine. In this analysis, actual statistics like running time and space
required, are collected.
Prof. Anand Gharu
38. CASES OF ANALYSIS ALGORITHMS
.
There are 3 types
1. Worst case
2. Best case
3. Average case
Best Case − Minimum time required for program execution.
Average Case −Average time required for program execution.
Worst Case − Maximum time required for program execution
39. Standard measure of efficiency
There are two important complexity measures:
1. Time complexity
2. Space complexity
Time complexity :
“The time which is required for analysis of given problem
of particular size is known as time complexity”
Space complexity :
“The amount of computer memory required tp solve the
given problem of particular size is called as space complexity”
Time efficiency - a measure of amount of time for an algorithm to execute.
Space efficiency - a measure of the amount of memory needed for an algorithm to
execute.
40.
41. Asymptotic notations
Asymptotic Notations are languages that allow us to
analyze an algorithm's running time by identifying its
behavior as the input size for the algorithm increases. This is
also known as an algorithm's growth rate
Asymptotic Notation gives us the ability to answer
these questions.
Following are the commonly used asymptotic notations
to calculate the running time complexity of an
algorithm.
1. Ο Notation
2. Ω Notation
3. θ Notation
42. BIG – oh NOTATION
Big Oh Notation, Ο
The notation Ο(n) is the formal way to express the upper
bound of an algorithm's running time. It measures the worst
case time complexity or the longest amount of time an
algorithm can possibly take to complete.
43. Omega NOTATION
Omega Notation, Ω
The notation Ω(n) is the formal way to express the lower
bound of an algorithm's running time. It measures the best
case time complexity or the best amount of time an
algorithm can possibly take to comp
44. Theta NOTATION
Theta Notation, θ
The notation θ(n) is the formal way to express both the
lower bound and the upper bound of an algorithm's running
time. It is represented as follows −
48. ALGORITHMIC STRATEGIES
Algorithm design strategies are the general approaches used to
develop efficient solution to problem.
Algorithm Strategies are :
1. Divide and conquer
2. Merge sort
3. Recursive algorithm
4. Backtracking algorithms
5. Heuristic algorithms
6. Dynamic Programming algorithm
49. DIVIDE AND CONQUER
In divide and conquer approach, the problem in hand, is divided into
smaller sub-problems and then each problem is solved independently.
When we keep on dividing the subproblems into even smaller sub-
problems, we may eventually reach a stage where no more division is
possible. Those "atomic" smallest possible sub-problem (fractions) are
solved. The solution of all sub-problems is finally merged in order to
obtain the solution of an original problem.
50. DIVIDE AND CONQUER
Operation for strategy :
Divide – Break the problem into subproblem of same type
Conquer – Recursively solve these sub problem
Combine – Combine the solution of sub problem
are based on divide and conquer
Following algorithms
strategies :
1. Merge sort
2. Binary search
3. Quick sort
4. Closest pair
5. Tower of Hanoi
51. DIVIDE AND CONQUER
1. Merge sort :
Merge Sort is a Divide and Conquer algorithm. It divides input array in
two halves, calls itself for the two halves and then merges the two sorted
halves. The merge() function is used for merging two halves. The
merge(arr, l, m, r) is key process that assumes that arr[l..m] and
arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.
52. DIVIDE AND CONQUER
2. Tower of Hanoi :
Tower of Hanoi is a mathematical puzzle where we have three rods and n
disks. The objective of the puzzle is to move the entire stack to another
rod, obeying the following simple rules:
1) Only one disk can be moved at a time.
2)Each move consists of taking the upper disk from one of the stacks and
placing it on top of another stack i.e. a disk can only be moved if it is the
uppermost disk on a stack.
3) No disk may be placed on top of a smaller disk.
54. GREEDY STRATEGIES
Greedy algorithm :
An algorithm is designed to achieve optimum solution for a given
problem. In greedy algorithm approach, decisions are made from the
given solution domain. As being greedy, the closest solution that seems
to provide an optimum solution is chosen.
Example of greedy strategy :
1. Travelling Salesman Problem
2. Prim's Minimal Spanning Tree Algorithm
3. Kruskal's Minimal Spanning Tree Algorithm
4. Dijkstra's Minimal Spanning Tree Algorithm
5. Knapsack Problem
6. Job Scheduling Problem
55. GREEDY STRATEGIES
1. Minimum Spanning tree (Prims or Kruskal’s algorithms)
The cost of the spanning tree is the sum of the weights of all the edges
in the tree. There can be many spanning trees. Minimum spanning tree is
the spanning tree where the cost is minimum among all the spanning
trees. There also can be many minimum spanning trees.
56. GREEDY STRATEGIES
1. Kruskal’s algorithms :
Kruskal’s Algorithm builds the spanning tree by adding edges one by
one into a growing spanning tree. Kruskal's algorithm follows greedy
approach as in each iteration it finds an edge which has least weight and
add it to the growing spanning tree.
Algorithm Steps :
Sort the graph edges with respect to their weights.
Start adding edges to the MST from the edge with the smallest weight
until the edge of the largest weight.
Only add edges which doesn't form a cycle , edges which connect only
disconnected components.
59. GREEDY STRATEGIES
2. Prims algorithm: Prim’s Algorithm also use Greedy approach to find
the minimum spanning tree. In Prim’s Algorithm we grow the spanning
tree from a starting position. Unlike an edge in Kruskal's, we
add vertex to the growing spanning tree in Prim's.
Algorithm Steps:
1. Initialize the minimum spanning tree with a vertex chosen at random.
2.Find all the edges that connect the tree to new vertices, find the
minimum and add it to the tree.
3. Keep repeating step 2 until we get a minimum spanning tree.