Given two integer arrays val[0...n-1] and wt[0...n-1] that represents values and weights associated with n items respectively. Find out the maximum value subset of val[] such that sum of the weights of this subset is smaller than or equal to knapsack capacity W. Here the BRANCH AND BOUND ALGORITHM is discussed .
This slide is prepared By these following Students of Dept. of CSE JnU, Dhaka. Thanks To: Nusrat Jahan, Arifatun Nesa, Fatema Akter, Maleka Khatun, Tamanna Tabassum.
It is related to Analysis and Design Of Algorithms Subject.Basically it describe basic of topological sorting, it's algorithm and step by step process to solve the example of topological sort.
The document discusses asymptotic notations that are used to describe the time complexity of algorithms. It introduces big O notation, which describes asymptotic upper bounds, big Omega notation for lower bounds, and big Theta notation for tight bounds. Common time complexities are described such as O(1) for constant time, O(log N) for logarithmic time, and O(N^2) for quadratic time. The notations allow analyzing how efficiently algorithms use resources like time and space as the input size increases.
The document discusses the theory of NP-completeness. It begins by defining the complexity classes P, NP, NP-hard, and NP-complete. It then explains the concepts of reduction and how none of the NP-complete problems can be solved in polynomial time deterministically. The document provides examples of NP-complete problems like satisfiability (SAT), vertex cover, and the traveling salesman problem. It shows how nondeterministic algorithms can solve these problems and how they can be transformed into SAT instances. Finally, it proves that SAT is the first NP-complete problem by showing it is in NP and NP-hard.
BackTracking Algorithm: Technique and ExamplesFahim Ferdous
This slides gives a strong overview of backtracking algorithm. How it came and general approaches of the techniques. Also some well-known problem and solution of backtracking algorithm.
Given two integer arrays val[0...n-1] and wt[0...n-1] that represents values and weights associated with n items respectively. Find out the maximum value subset of val[] such that sum of the weights of this subset is smaller than or equal to knapsack capacity W. Here the BRANCH AND BOUND ALGORITHM is discussed .
This slide is prepared By these following Students of Dept. of CSE JnU, Dhaka. Thanks To: Nusrat Jahan, Arifatun Nesa, Fatema Akter, Maleka Khatun, Tamanna Tabassum.
It is related to Analysis and Design Of Algorithms Subject.Basically it describe basic of topological sorting, it's algorithm and step by step process to solve the example of topological sort.
The document discusses asymptotic notations that are used to describe the time complexity of algorithms. It introduces big O notation, which describes asymptotic upper bounds, big Omega notation for lower bounds, and big Theta notation for tight bounds. Common time complexities are described such as O(1) for constant time, O(log N) for logarithmic time, and O(N^2) for quadratic time. The notations allow analyzing how efficiently algorithms use resources like time and space as the input size increases.
The document discusses the theory of NP-completeness. It begins by defining the complexity classes P, NP, NP-hard, and NP-complete. It then explains the concepts of reduction and how none of the NP-complete problems can be solved in polynomial time deterministically. The document provides examples of NP-complete problems like satisfiability (SAT), vertex cover, and the traveling salesman problem. It shows how nondeterministic algorithms can solve these problems and how they can be transformed into SAT instances. Finally, it proves that SAT is the first NP-complete problem by showing it is in NP and NP-hard.
BackTracking Algorithm: Technique and ExamplesFahim Ferdous
This slides gives a strong overview of backtracking algorithm. How it came and general approaches of the techniques. Also some well-known problem and solution of backtracking algorithm.
The document discusses GUI technologies in Python. It covers Tkinter, which is the standard GUI library in Python. Tkinter can be used to create desktop applications and provides widgets like labels, buttons, entries and frames. It also discusses how to create windows, add widgets, handle events and create a simple calculator application as an example.
This document provides information about priority queues and binary heaps. It defines a binary heap as a nearly complete binary tree where the root node has the maximum/minimum value. It describes heap operations like insertion, deletion of max/min, and increasing/decreasing keys. The time complexity of these operations is O(log n). Heapsort, which uses a heap data structure, is also covered and has overall time complexity of O(n log n). Binary heaps are often used to implement priority queues and for algorithms like Dijkstra's and Prim's.
The document summarizes and provides code examples for four pattern matching algorithms:
1. The brute force algorithm checks each character position in the text to see if the pattern starts there, running in O(mn) time in worst case.
2. The Boyer-Moore algorithm uses a "bad character" shift and "good suffix" shift to skip over non-matching characters in the text, running faster than brute force.
3. The Knuth-Morris-Pratt algorithm uses a failure function to determine the maximum shift of the pattern on a mismatch, avoiding wasteful comparisons.
4. The failure function allows KMP to skip portions of the text like Boyer-Moore, running
The document discusses various backtracking techniques including bounding functions, promising functions, and pruning to avoid exploring unnecessary paths. It provides examples of problems that can be solved using backtracking including n-queens, graph coloring, Hamiltonian circuits, sum-of-subsets, 0-1 knapsack. Search techniques for backtracking problems include depth-first search (DFS), breadth-first search (BFS), and best-first search combined with branch-and-bound pruning.
This document describes the steps to construct a LALR parser from a context-free grammar:
1. Create an augmented grammar by adding a new start symbol and productions.
2. Generate kernel items by introducing dots in productions and adding second components. Then take closures of the items.
3. Compute the goto function to fill the parsing table.
4. Construct the CLR parsing table from the items and gotos.
5. Shrink the CLR parser by merging equivalent states to produce the more efficient LALR parsing table with fewer states.
Lecture 21 problem reduction search ao star searchHema Kashyap
The AO* search algorithm is used to find optimal solutions for AND/OR search problems. It uses two arrays (OPEN and CLOSE) and a heuristic function h(n) to estimate the cost to reach the goal. The algorithm selects the most promising node from OPEN, expands it to find successors, and calculates their h(n) values, adding them to OPEN. It continues until the start node is marked as solved or unsolvable. AO* finds optimal solutions but can be inefficient for unsolvable problems compared to other algorithms.
This document discusses the greedy algorithm approach and the knapsack problem. It defines greedy algorithms as choosing locally optimal solutions at each step in hopes of reaching a global optimum. The knapsack problem is described as packing items into a knapsack to maximize total value without exceeding weight capacity. An optimal knapsack algorithm is presented that sorts by value-to-weight ratio and fills highest ratios first. An example applies this to maximize profit of 440 by selecting full quantities of items B and A, and half of item C for a knapsack with capacity of 60.
This document discusses propositional logic and knowledge representation. It introduces propositional logic as the simplest form of logic that uses symbols to represent facts that can then be joined by logical connectives like AND and OR. Truth tables are presented as a way to determine the truth value of propositions connected by these logical operators. The document also discusses concepts like models of formulas, satisfiable and valid formulas, and rules of inference like modus ponens and disjunctive syllogism that allow deducing new facts from initial propositions. Examples are provided to illustrate each concept.
This document provides an overview of first-order logic in artificial intelligence:
- First-order logic extends propositional logic by adding objects, relations, and functions to represent knowledge. Objects can include people and numbers, while relations include concepts like "brother of" and functions like "father of".
- A sentence in first-order logic contains a predicate and a subject, represented by a variable. For example, "tall(John)" asserts that John is tall. Quantifiers like "forall" and "exists" are used to structure sentences.
- First-order logic contains constants, variables, predicates, functions, connectives, equality, and quantifiers as its basic elements.
The Boyer-Moore string matching algorithm was developed in 1977 and is considered one of the most efficient string matching algorithms. It works by scanning the pattern from right to left and shifting the pattern by multiple characters if a mismatch is found, using preprocessing tables. The algorithm constructs a bad character shift table during preprocessing that stores the maximum number of positions a mismatched character can shift the pattern. It then aligns the pattern with the text and checks for matches, shifting the pattern right by the value in the table if a mismatch occurs.
Syntax-Directed Translation into Three Address Codesanchi29
The document discusses syntax-directed translation of code into three-address code. It defines semantic rules for generating three-address code for expressions, boolean expressions, and control flow statements. Temporary variables are generated for subexpressions and intermediate values. The semantic rules specify generating three-address code statements using temporary variables. Backpatching is also discussed as a technique to replace symbolic names in goto statements with actual addresses after code generation.
This document discusses string matching algorithms. It defines string matching as finding a pattern within a larger text or string. It then summarizes two common string matching algorithms: the naive algorithm and Rabin-Karp algorithm. The naive algorithm loops through all possible shifts of the pattern and directly compares characters. Rabin-Karp also shifts the pattern but compares hash values of substrings first before checking individual characters to reduce comparisons. The document provides examples of how each algorithm works on sample strings.
This slides contains assymptotic notations, recurrence relation like subtitution method, iteration method, master method and recursion tree method and sorting algorithms like merge sort, quick sort, heap sort, counting sort, radix sort and bucket sort.
The document discusses the knapsack problem and greedy algorithms. It defines the knapsack problem as an optimization problem where given constraints and an objective function, the goal is to find the feasible solution that maximizes or minimizes the objective. It describes the knapsack problem has having two versions: 0-1 where items are indivisible, and fractional where items can be divided. The fractional knapsack problem can be solved using a greedy approach by sorting items by value to weight ratio and filling the knapsack accordingly until full.
The document discusses constructing a directed acyclic graph (DAG) to represent the computation of values in a basic block of code. It describes how to build the DAG by processing each statement and creating nodes for operators and values. The DAG makes it possible to analyze the code block to optimize computations by removing duplicate subexpressions and determine which values are used inside and outside the block.
The document discusses string matching algorithms. It introduces the naive O(mn) algorithm and describes how it works by performing character-by-character comparisons. It then introduces the Knuth-Morris-Pratt (KMP) algorithm, which improves the runtime to O(n) by using a prefix function to avoid re-checking characters. The prefix function encapsulates information about how the pattern matches shifts of itself. The KMP algorithm uses the prefix function to avoid backtracking during matching. An example is provided to illustrate how the KMP algorithm works on a sample string and pattern.
The document discusses the problem of determining the optimal way to fully parenthesize the product of a chain of matrices to minimize the number of scalar multiplications. It presents a dynamic programming approach to solve this problem in four steps: 1) characterize the structure of an optimal solution, 2) recursively define the cost of an optimal solution, 3) compute the costs using tables, 4) construct the optimal solution from the tables. An example is provided to illustrate computing the costs table and finding the optimal parenthesization of a chain of 6 matrices.
Python Workshop - Learn Python the Hard WayUtkarsh Sengar
This document provides an introduction to learning Python. It discusses prerequisites for Python, basic Python concepts like variables, data types, operators, conditionals and loops. It also covers functions, files, classes and exceptions handling in Python. The document demonstrates these concepts through examples and exercises learners to practice char frequency counting and Caesar cipher encoding/decoding in Python. It encourages learners to practice more to master the language and provides additional learning resources.
The document provides source code solutions to 21 programming problems or practical exercises in Python. For each problem, it lists the objective, provides the source code, and displays sample output. The problems cover topics like checking if a number is prime, palindrome, sorting algorithms, file handling, object-oriented programming concepts like classes and methods, and more. It is a practical file with Python code and solutions for Class 12 Computer Science students.
The document discusses GUI technologies in Python. It covers Tkinter, which is the standard GUI library in Python. Tkinter can be used to create desktop applications and provides widgets like labels, buttons, entries and frames. It also discusses how to create windows, add widgets, handle events and create a simple calculator application as an example.
This document provides information about priority queues and binary heaps. It defines a binary heap as a nearly complete binary tree where the root node has the maximum/minimum value. It describes heap operations like insertion, deletion of max/min, and increasing/decreasing keys. The time complexity of these operations is O(log n). Heapsort, which uses a heap data structure, is also covered and has overall time complexity of O(n log n). Binary heaps are often used to implement priority queues and for algorithms like Dijkstra's and Prim's.
The document summarizes and provides code examples for four pattern matching algorithms:
1. The brute force algorithm checks each character position in the text to see if the pattern starts there, running in O(mn) time in worst case.
2. The Boyer-Moore algorithm uses a "bad character" shift and "good suffix" shift to skip over non-matching characters in the text, running faster than brute force.
3. The Knuth-Morris-Pratt algorithm uses a failure function to determine the maximum shift of the pattern on a mismatch, avoiding wasteful comparisons.
4. The failure function allows KMP to skip portions of the text like Boyer-Moore, running
The document discusses various backtracking techniques including bounding functions, promising functions, and pruning to avoid exploring unnecessary paths. It provides examples of problems that can be solved using backtracking including n-queens, graph coloring, Hamiltonian circuits, sum-of-subsets, 0-1 knapsack. Search techniques for backtracking problems include depth-first search (DFS), breadth-first search (BFS), and best-first search combined with branch-and-bound pruning.
This document describes the steps to construct a LALR parser from a context-free grammar:
1. Create an augmented grammar by adding a new start symbol and productions.
2. Generate kernel items by introducing dots in productions and adding second components. Then take closures of the items.
3. Compute the goto function to fill the parsing table.
4. Construct the CLR parsing table from the items and gotos.
5. Shrink the CLR parser by merging equivalent states to produce the more efficient LALR parsing table with fewer states.
Lecture 21 problem reduction search ao star searchHema Kashyap
The AO* search algorithm is used to find optimal solutions for AND/OR search problems. It uses two arrays (OPEN and CLOSE) and a heuristic function h(n) to estimate the cost to reach the goal. The algorithm selects the most promising node from OPEN, expands it to find successors, and calculates their h(n) values, adding them to OPEN. It continues until the start node is marked as solved or unsolvable. AO* finds optimal solutions but can be inefficient for unsolvable problems compared to other algorithms.
This document discusses the greedy algorithm approach and the knapsack problem. It defines greedy algorithms as choosing locally optimal solutions at each step in hopes of reaching a global optimum. The knapsack problem is described as packing items into a knapsack to maximize total value without exceeding weight capacity. An optimal knapsack algorithm is presented that sorts by value-to-weight ratio and fills highest ratios first. An example applies this to maximize profit of 440 by selecting full quantities of items B and A, and half of item C for a knapsack with capacity of 60.
This document discusses propositional logic and knowledge representation. It introduces propositional logic as the simplest form of logic that uses symbols to represent facts that can then be joined by logical connectives like AND and OR. Truth tables are presented as a way to determine the truth value of propositions connected by these logical operators. The document also discusses concepts like models of formulas, satisfiable and valid formulas, and rules of inference like modus ponens and disjunctive syllogism that allow deducing new facts from initial propositions. Examples are provided to illustrate each concept.
This document provides an overview of first-order logic in artificial intelligence:
- First-order logic extends propositional logic by adding objects, relations, and functions to represent knowledge. Objects can include people and numbers, while relations include concepts like "brother of" and functions like "father of".
- A sentence in first-order logic contains a predicate and a subject, represented by a variable. For example, "tall(John)" asserts that John is tall. Quantifiers like "forall" and "exists" are used to structure sentences.
- First-order logic contains constants, variables, predicates, functions, connectives, equality, and quantifiers as its basic elements.
The Boyer-Moore string matching algorithm was developed in 1977 and is considered one of the most efficient string matching algorithms. It works by scanning the pattern from right to left and shifting the pattern by multiple characters if a mismatch is found, using preprocessing tables. The algorithm constructs a bad character shift table during preprocessing that stores the maximum number of positions a mismatched character can shift the pattern. It then aligns the pattern with the text and checks for matches, shifting the pattern right by the value in the table if a mismatch occurs.
Syntax-Directed Translation into Three Address Codesanchi29
The document discusses syntax-directed translation of code into three-address code. It defines semantic rules for generating three-address code for expressions, boolean expressions, and control flow statements. Temporary variables are generated for subexpressions and intermediate values. The semantic rules specify generating three-address code statements using temporary variables. Backpatching is also discussed as a technique to replace symbolic names in goto statements with actual addresses after code generation.
This document discusses string matching algorithms. It defines string matching as finding a pattern within a larger text or string. It then summarizes two common string matching algorithms: the naive algorithm and Rabin-Karp algorithm. The naive algorithm loops through all possible shifts of the pattern and directly compares characters. Rabin-Karp also shifts the pattern but compares hash values of substrings first before checking individual characters to reduce comparisons. The document provides examples of how each algorithm works on sample strings.
This slides contains assymptotic notations, recurrence relation like subtitution method, iteration method, master method and recursion tree method and sorting algorithms like merge sort, quick sort, heap sort, counting sort, radix sort and bucket sort.
The document discusses the knapsack problem and greedy algorithms. It defines the knapsack problem as an optimization problem where given constraints and an objective function, the goal is to find the feasible solution that maximizes or minimizes the objective. It describes the knapsack problem has having two versions: 0-1 where items are indivisible, and fractional where items can be divided. The fractional knapsack problem can be solved using a greedy approach by sorting items by value to weight ratio and filling the knapsack accordingly until full.
The document discusses constructing a directed acyclic graph (DAG) to represent the computation of values in a basic block of code. It describes how to build the DAG by processing each statement and creating nodes for operators and values. The DAG makes it possible to analyze the code block to optimize computations by removing duplicate subexpressions and determine which values are used inside and outside the block.
The document discusses string matching algorithms. It introduces the naive O(mn) algorithm and describes how it works by performing character-by-character comparisons. It then introduces the Knuth-Morris-Pratt (KMP) algorithm, which improves the runtime to O(n) by using a prefix function to avoid re-checking characters. The prefix function encapsulates information about how the pattern matches shifts of itself. The KMP algorithm uses the prefix function to avoid backtracking during matching. An example is provided to illustrate how the KMP algorithm works on a sample string and pattern.
The document discusses the problem of determining the optimal way to fully parenthesize the product of a chain of matrices to minimize the number of scalar multiplications. It presents a dynamic programming approach to solve this problem in four steps: 1) characterize the structure of an optimal solution, 2) recursively define the cost of an optimal solution, 3) compute the costs using tables, 4) construct the optimal solution from the tables. An example is provided to illustrate computing the costs table and finding the optimal parenthesization of a chain of 6 matrices.
Python Workshop - Learn Python the Hard WayUtkarsh Sengar
This document provides an introduction to learning Python. It discusses prerequisites for Python, basic Python concepts like variables, data types, operators, conditionals and loops. It also covers functions, files, classes and exceptions handling in Python. The document demonstrates these concepts through examples and exercises learners to practice char frequency counting and Caesar cipher encoding/decoding in Python. It encourages learners to practice more to master the language and provides additional learning resources.
The document provides source code solutions to 21 programming problems or practical exercises in Python. For each problem, it lists the objective, provides the source code, and displays sample output. The problems cover topics like checking if a number is prime, palindrome, sorting algorithms, file handling, object-oriented programming concepts like classes and methods, and more. It is a practical file with Python code and solutions for Class 12 Computer Science students.
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
Python
Language
is uesd in engineeringStory adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they s
Python is a versatile, object-oriented programming language that can be used for web development, data analysis, and more. It has a simple syntax and is easy to read and learn. Key features include being interpreted, dynamically typed, supporting functional and object-oriented programming. Common data types include numbers, strings, lists, dictionaries, tuples, and files. Functions and classes can be defined to organize and reuse code. Regular expressions provide powerful string manipulation. Python has a large standard library and is used widely in areas like GUIs, web scripting, AI, and scientific computing.
The document contains summaries of 4 programs written by Ilias Ahmed:
1) A program to add two numbers in C that uses scanf and printf to get user input and display the sum.
2) A program that checks if a user input string is a comment in C by checking for // or /* at the start.
3) A program that checks what operator a user input string represents, such as >, <, =, +, -, etc.
4) Details about Ilias Ahmed's compiler design lab work and qualifications including Oracle OCP, Java certification, and Red Hat Linux certification.
The document provides source code solutions to 20 programming problems in Python. For each problem, it includes the problem statement, source code, and sample output. The problems cover a range of concepts like checking if a number is prime, palindrome, compound interest calculation, ASCII conversions, data type checking, recursion, searching, sorting, and plotting graphs. It also includes examples of creating libraries and importing modules in Python. The solutions demonstrate basic programming concepts and techniques in Python.
This document provides a cheat sheet on Python keywords and basic data types. It lists common Python keywords like False, True, and, or, not, break, continue, class, def, if, else, for, while, in, is, None, lambda, and return along with code examples. It also covers basic data types like Boolean, integer, float, string, list, set, dictionary, and complex data types like classes. It provides examples of using lists, sets, dictionaries, classes and functions in Python.
This document provides examples and descriptions of Python keywords and basic data types. It discusses keywords like False, True, and, or, not, break, continue, class, def, if, elif, else, for, while, in, is, None, lambda, and return. It also covers basic data types like integers, floats, strings, lists, sets, dictionaries, and Boolean values. It provides code examples to demonstrate the usage of these keywords and data types in Python.
The document discusses the benefits of declarative programming using Scala. It provides examples of implementing algorithms and data structures declaratively in Scala. It also discusses the history and future of Scala, as well as how Scala encourages thinking about programs as transformations rather than changes to memory.
These are the slides of the second part of this multi-part series, from Learn Python Den Haag meetup group. It covers List comprehensions, Dictionary comprehensions and functions.
This document contains a summary of 14 experiments conducted for the Numerical Analysis and Statistical Techniques lab course. Each experiment involves writing a C program to solve a different numerical problem, such as finding the largest of three numbers, solving quadratic equations, numerical integration using trapezoidal and Simpson's rules, and solving differential equations using numerical methods like Runge-Kutta. For each experiment, the document includes the aim, flowchart, C program code, and sample output.
The document contains the answers to 12 tasks/problems involving C programming concepts like arrays, matrices, strings, functions, recursion, structures, files etc. Each answer provides the full code to solve the problem. The tasks include programs to sort arrays, add matrices, count characters in strings, check palindromes, find prime numbers using functions, calculate factorials and Fibonacci terms recursively, define nested structures, and read/write numbers to files.
Python is a high-level, interpreted, interactive and object-oriented scripting language that can run on many platforms like Windows, Linux, and Mac. It was created in 1990 by Guido van Rossum and draws influence from languages like C, C++, and Java but has a simpler syntax and emphasizes code readability. Python code is typically more concise than other languages and it has a large standard library, making it useful for tasks like web development, science, and data analysis.
1. The document discusses several programming tasks including defining functions to calculate statistics, a program to read and display lines from a text file, converting decimal numbers to binary, and other tasks involving text processing and lists.
2. Functions are defined to calculate the median, mode, and mean of a list of numbers. A program allows a user to enter numbers, displays statistics, and tests the functions.
3. Other programs and functions discussed include navigating and displaying lines from a text file, converting decimals to other number bases, finding unique words from a file, tracking word frequencies, converting lists to dictionaries, and removing duplicate sublists.
The document provides code snippets for creating programs in C to:
1. Restrict mouse pointer movement and display pointer position by accessing the interrupt table and using functions like int86().
2. Create simple viruses by writing programs that shutdown the system, open internet explorer infinitely, or delete IE files.
3. Create DOS commands by writing C programs that can be executed from the command line to list files or directories.
4. Switch to 256 color graphics mode and create directories by calling int86() and writing to registers.
5. Develop a basic paint brush program using graphics functions to draw shapes determined by brush properties when the mouse is clicked.
This document provides a concise reference card summarizing key aspects of the Python 2.5 programming language, including variable types, basic syntax, object orientation, modules, exceptions, input/output, and the standard library. It covers topics like numbers, sequences, dictionaries, sets, functions, classes, imports, exceptions, files, and common library modules.
The basics of Python are rather straightforward. In a few minutes you can learn most of the syntax. There are some gotchas along the way that might appear tricky. This talk is meant to bring programmers up to speed with Python. They should be able to read and write Python.
- Python is a dynamic, interpreted, object-oriented programming language where variables do not need to be declared and type checked.
- It uses indentation rather than curly braces to delimit code blocks, and is readable and flexible.
- Key features covered include variables, strings, functions, conditionals, loops, lists, tuples, and dictionaries. Examples are provided for common operations on each data type.
Similar to Lab report for Prolog program in artificial intelligence. (20)
Malware Detection Approaches using Data Mining Techniques.pptxAlamgir Hossain
The document discusses malware detection approaches using data mining techniques. It describes signature-based and behavior-based approaches. Signature-based detection identifies malware by matching signatures in a predefined database, but struggles with polymorphic malware. Behavior-based detection analyzes malware behaviors through dynamic analysis, allowing detection of novel malware but having higher computational costs. Both approaches have advantages and limitations for malware detection.
Structure Computer Programming with C-02 by Alamgir Hossain
Topics Covered: Introduction of a C program with Proper Exam. From this slide you will learn all about a c program.
Computer graphics lab report with code in cppAlamgir Hossain
This is the lab report for computer graphics in cpp language. Basically this course is only for the computer science and engineering students.
Problem list:
1.Program for the generation of Bresenham Line Drawing.
2. Program for the generation of Digital Differential Analyzer (DDA) Line Drawing.
3. Program for the generation of Midpoint Circle Drawing.
4. Program for the generation of Midpoint Ellipse Drawing.
5. Program for the generation of Translating an object.
6. Program for the generation of Rotating an Object.
7. Program for the generation of scaling an object.
All programs are coaded in cpp language .
Report on student-faculty document sharing android projectAlamgir Hossain
This project aims to create an online portal for document sharing between faculty and students at a college. The portal will allow faculty to upload documents like syllabi, timetables, notes and notifications from their computers. Students can view and download the documents relevant to their semester from the online server using an Android app on their mobile devices. Faculty have access to upload and manage documents for all semesters while students only see information for their semester. The system uses a login system for security and allows documents to be shared in common formats like Word and PDF.
A lab report on modeling and simulation with python codeAlamgir Hossain
You can find the solution with Objective:
1.Write a program to implement Linear Congruential Generators in python.
2.Write a program to implement Bernouli distribution in python.
3. Write a program to implement Binomal distribution in python.
4. Write a program to implement geometry distribution in python.
5. Write a program to find GCD in python.
6. Write a program to find LCM in python.
Digital signal Processing all matlab code with Lab report Alamgir Hossain
Digital signal processing(DSP) laboratory with matlab software....
Problem List :
1.To write a Matlab program to evaluate the impulse response of the system.
2.Computation of N point DFT of a given sequence and to plot magnitude and phase spectrum.
3.To Generate continuous time sinusoidal signal, discrete time cosine signal.
4.To find the DFT / IDFT of given signal.
5.Program for generation of Sine sequence.
6.Program for generation of Cosine sequence.
7. Program for the generation of UNIT impulse signal
8. Program for the generation of Exponential signal.
This is the presentation slide for Microsoft new product Ms-Teams. Topics of this presentation are Introduction,Features,Facilities, Advantages, Disadvantages, Limitations,Conclusions of ms-teams.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
Lab report for Prolog program in artificial intelligence.
1. 1
Experiment No. : 01
Experiment Name : Write a Prolog program for addition of two numbers in Artificial Intelligence.
Objective : To find the summation of two numbers.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read X , Y
Set S to X+Y
Write S
Code :
% Prolog program for addition of two numbers------------
% Alamgir, CSE, JUST
go:- write('Enter first number : '), read(X),nl,
write('Enter second number : '), read(Y),nl,
sum(X,Y).
sum(X,Y):-
S is X+Y,
write('Summation of the two given number is : '), write(S)
Input :
go.
Enter first number : 100.
Enter second number : 200.
Output :
Summation of the two given number is : 300
2. 2
Experiment No. : 02
Experiment Name : Write a Prolog program for addition & multiplication of two numbers in Artificial
Intelligence.
Objective : To find the addition & multiplication of two numbers.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read X , Y
Set S to X+Y
Set M to X*Y
Write S,M
Code :
% Prolog program for addition and multplication--------
% Alamgir, CSE, JUST
go:- write('Enter first number : '),read(X),nl,
write('Enter second number : '),read(Y),nl,
addmul(X,Y).
addmul(X,Y):-
S is X+Y,
M is X*Y,
write('Addition of the two number is : '),write(S),nl,
write('Multiplication of the two number is : '),write(M).
Input:
go.
Enter first number : 20.
Enter second number : 10.
Output :
Addition of the two number is : 30
Multiplication of the two number is : 200
3. 3
Experiment No. : 03
Experiment Name : Write a Prolog program for finding the sum of all numbers in a given list in Artificial
Intelligence.
Objective : To find the sum of all numbers in a given list.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read all numbers
Add number and set to Result
Write Result
Code :
% Prolog program for find the sum of all numbers in a given list-------
% Alamgir, CSE, JUST
list([H|T],Result):-
listhelper(T,H,Result).
listhelper([],Acc,Acc).
listhelper([H|T],Acc,Result):-
Nacc is H+Acc,
listhelper(T,Nacc,Result).
Input: list([12,23,4,5,10,23,45],Result).
Output : Result = 122
4. 4
Experiment No. : 04
Experiment Name : Write a Prolog program for comparing Character and String in Artificial Intelligence.
Objective : To compare character and String.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read two string
Compare Strings
Write Result
Code :
% Alamgir, CSE, JUST
predicates
start
comp_str(string,string)
comp_char(char,string)
goal
clearwindow,
start.
clauses
start:-
comp_str("abcd","dcab"),
write("equal"),nl.
start:-
write("not equal"),nl.
comp_str(Str1,Str2):-
Str1 <> "",
frontchar(Str1,Char1,Rest1),
comp_char(Char1,Str2),
comp_str(Rest1,Str2).
comp_str(Str1,Str2):-
Str1 = "".
comp_str(Str1,Str2):-
fail.
6. 6
Experiment No. : 05
Experiment Name : Write a Prolog program to determine whether a element in a member of list in Artificial
Intelligence.
Objective : To determine whether a element in a member or not in a given list .
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read list of elemnets
Read the element
Check the element in the list or not
If exist set s to “Found”
Else set s to “Not Found”
Write s
Code :
% PROLOG PROGRAM TO DETERMINE WHETHER A ELEMENT IS A MEMBER OF LIST
% Alamgir, CSE, JUST
list=integer*
findnum(integer,list).
findnum(X,[]):-
write('The number is Not Found in the list.').
findnum(X,[X|Tail]):-
write('The number is Found in the list.').
findnum(X,[Y|Tail]):-
findnum(X,Tail).
Input : findnum(3,[1,2,3,4,5,6,7,8,10,11,12]).
Output : The number is Found in the list.
7. 7
Experiment No. : 06
Experiment Name : Write a Prolog program to find sublists of the given list in Artificial Intelligence.
Objective : To find sublists of the given list.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read list of elemnets
Read the sublist
Check the sublist in the list or not
If exist set s to YES
Else set s to Not
Write s
Code :
% Alamgir, CSE, JUST
name = symbol
namelist = name*
predicates
sublist(namelist,namelist)
clauses
sublist([],[]).
sublist([First|Rest],[First|Sub]):-
sublist(Rest,Sub).
sublist([_|Rest],Sub):-
sublist(Rest,Sub).
Input : sublist([a,b,c],X).
Output :
X=["a","b","c"] ;
X=["a","b"] ;
X=["a","c"] ;
X=["a"] ;
X=["b","c"];
X=["b"] ;
X=["c"] ;
X=[]
8. 8
Experiment No. : 07
Experiment Name : Write a prolog program for murder my story in Artificial Intelligence.
Objective : To find the murder of my story.
Software and Tools : GNU-Prolog Console, Notepad++.
Code :
% Alamgir, CSE, JUST
predicates
% pair(symbol,symbol)
iskiller(symbol,symbol)
male(symbol)
female(symbol)
isvictim(symbol)
not_at_bar(symbol,symbol)
not_at_beach(symbol,symbol)
not_alone(symbol)
twin(symbol,symbol)
younger(symbol,symbol)
child(symbol)
clauses
male(husband).
male(brother).
male(son).
female(alice).
female(daughter).
twin(brother,alice).
twin(son,daughter).
child(son).
child(daughter).
not_alone(
not_alone(alice).
not_alone(brother).
not_alone(X):-
10. 10
Experiment No. : 08
Experiment Name : Write a prolog program to reverse a list in Artificial Intelligence.
Objective : To reverse a given list.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read list of elemnets
Function for reverse
Set Result to reverse list
Write Result
Code :
% prolog program for reverse a given list------
% Alamgir, CSE, JUST
list([H|T],Result):-
reverselist(T, [H], Result).
reverselist([], Acc, Acc).
reverselist([H|T], Acc, Result):-
reverselist(T, [H|Acc], Result).
Input : list([3,5,6,7,8,12,34,120,22],Result).
Output : Result = [22,120,34,12,8,7,6,5,3]
11. 11
Experiment No. : 09
Experiment Name : Write a prolog program to find the permutation of the given list in Artificial Intelligence.
Objective : To find the permutation of the given list.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read list of elemnets
Function for permutation is permute
Set Result p
Write p
Code :
% Alamgir, CSE, JUST
% PROLOG PROGRAM TO FIND THE PERMUTATION OF THE GIVEN LIST
% domains
list = symbol*
%predicates
permute(list,list).
del(symbol,list,list).
%clauses
del(X,[X|L1],L1).
del(X,[Y|L1],[Y|L2]):-
del(X,L1,L2).
permute([],[]).
permute(L,[X|P]):-
del(X,L,L1),
permute(L1,P).
Input : permute([a,b,c],P).
Output :
P=["a","b","c"];
P=["a","c","b"];
P=["b","a","c"];
P=["b","c","a"];
P=["c","a","b"];
P=["c","b","a"];
12. 12
Experiment No. : 10
Experiment Name : Write a prolog program to find last item of the list in Artificial Intelligence.
Objective : To find the last item of the list.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read list of elemnets
Function for check element from first to last
Set X to last elemtnt
Write X
Code :
% Last item of a given list.....
% Alamgir, CSE, JUST
namelist = symbol*
lastd(namelist,symbol).
lastd([Head],X):-
X = Head.
lastd([_|Tail],X):-
lastd(Tail,X).
Input : lastd([a,b,c,d,e,f,g,h,I,j,k],X).
Output : X = k
13. 13
Experiment No. : 12
Experiment Name : Write a prolog program to determine the greatest common divisor of two positive integer
numbers in Artificial Intelligence.
Objective : To determine the greatest common divisor of two positive integer numbers.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read X,Y
Function gcd (X,Y)
Set Result into X
Write X
Code :
% Prolog program for finding GCD of the two given number
% Alamgir Hossain, CSE, JUST
go:- write('Enter the first number : '),read(X),nl,
write('Enter the second number : '),read(Y),nl,
gcd(X,Y).
gcd(X,Y):-
X=Y,
write('GCD of the two given numbers is : '),write(X);
X=0,write('GCD of the two given numbers is : '),write(Y);
Y=0,write('GCD of the two given numbers is : '),write(X);
Y>X,Y1 is Y-X,gcd(X,Y1);
X>Y,Y1 is X-Y,gcd(Y1,Y).
Input :
go.
Enter the first number : 24.
Enter the second number : 3.
Output : GCD of the two given numbers is : 3
14. 14
Experiment No. : 13
Experiment Name : Write a prolog program that stores information about your family, and will answer queries
about relationships in Artificial Intelligence.
Objective : To stores information about my family, and will answer queries about relationships.
Software and Tools : GNU-Prolog Console, Notepad++.
Code :
% Prolog program that store information about my family
% Alamgir, CSE, JUST
% Facts
father(mosiur, sharmin).
father(mosiur, rawshanara).
father(mosiur, alamgir).
father(mosiur, rahim).
father(auncle, liza).
father(auncle, robin).
father(robin, abid).
father(robin, snigdho).
father(sumon, apu).
mother(morium, sharmin).
mother(morium, alamgir).
mother(morium, rahim).
mother(aunty, liza).
mother(aunty, robin).
mother(sharmin, abid).
mother(sharmin, snigdho).
mother(rawshanara, apu).
% Rules-------
parent(X, Y) :- father(X, Y).
parent(X, Y) :- mother(X, Y).
grandfather(X, Y) :- father(X, Z), parent(Z, Y).
grandmother(X, Y) :- mother(X, Z), parent(Z, Y).
mama(X, Y) :- mother(X, Z), father(Z, Y).
15. 15
huswife(X, Y) :- father(X, Z), mother(Y, Z).
brothersistertr(Y, Z) :- father(X, Y), father(X, Z).
mamavagne(Z, Y) :- father(X, Z),grandfather(X, Y).
Input : parent(X, Y).
Output :
X = mosiur
Y = sharmin ? ;
X = mosiur
Y = rawshanara ? ;
X = mosiur
Y = alamgir ? ;
X = mosiur
Y = rahim ? ;
16. 16
Experiment No. : 14
Experiment Name : Write a prolog program to print a Fibonacci series in Artificial Intelligence.
Objective : To print a Fibonacci series up to n numbers.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read N
Function Fibonacci for the Fibonacci series
Write Result
Code :
% Prolog program for printing fibonacci series upto n numbers------
go:-
write('Enter a number : '),read(N),nl,
write('Fibonacci series for '),write(N),write(' elements is : '),nl,
A is 0,
B is 1,
write(A),write(' '),write(B),write(' '),
fibonacci(N,A,B).
fibonacci(N,A,B):-
(
N<2, write('Complete');
C is A+B,
write(C),write(' , '),
D is B,
E is C,
N1 is N-1, fibonacci(N1,D,E)
).
Input : go.
Enter a number : 10.
Output :
Fibonacci series for 10 elements is :
0 1 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , Complete
17. 17
Experiment No. : 15
Experiment Name : Write a prolog program to calculate the factorial of a number using recursion in Artificial
Intelligence.
Objective : To calculate the factorial of a number using recursion.
Software and Tools : GNU-Prolog Console, Notepad++.
Pseudo code :
Read N
Repeat function fact and multiple N by N-1
Set result into F
Write F
Code :
% Alamgir, CSE, JUST
fact(0,1).
fact(N,F):-
(
N>0 ->
(
N1 is N-1,
fact(N1,F1),
F is N*F1
);
write('N should be greater than 0.')
).
Input : fact(8,R).
Output : R = 40320