Posts

Showing posts from May, 2023
Image
   DATA STRUCTURE WITH C++ PROGRAMMING USING STACK PREREQUISITES TO IMPLEMENTING STACK IN C++ We will need to understand how to use some of the constructs in C++ that makes up the implementation of stack in C++ against. And this concepts will also help you in developing other codes and to debug or understand the C++ codes in a company's code bank or to interpret a boiler plate code (a ready made code). Some of these constructs or concepts are: 1. sizeof() 2. Function 3. Pointer 4. Function Pointer 5. Arrow operator 6. malloc() 7. typedef 8. struct PHASE 1: sizeof() It is used to determine the size of variables used in a program, it can determine the size of primitive (or predefined) datatype too and for any user-defined datatypes. It is an inbuilt keyword and a compile-time operator. syntax-1 using variable sizeof(variableName); syntax-2 using primitive datatype sizeof(datatype); //code implementation #include<iostream> using namespace std; int main(){ //declare variable
Image
   DATA STRUCTURE WITH C++ PROGRAMMING USING VECTOR An array is of fixed size, C++ doesn't have inbuilt function to add elements to or delete element from an array (Except you use cin and declare variable to store elements to be added to the end (rear) of the existing elements), and array cannot handle data dynamically. Vector comes into the picture to solve the deficiency of array. A vector is a dynamic array that can change in size during runtime, hence vector  has dynamic/heap memory allocation and handles memory management. You need to add the header file of a vector to your program: #include<vector> Vector operations The following are the basic functions we can perform on a vector: add, access, change and remove elements Vector Inbuilt functions  The following are functions that can be used to perform several operations on a vector which are obtained from C++ STL (Standard Template Library) front() returns the first element of the vector back() returns the last element o
 UNIT 2 Python Variable, datatypes, Input and Output function and comments AGENDA .py is the file extension of python  1. OUTPUT FUNCTION 2. HOW TO USE VARIABLE 3. INPUT Function 4. COMMENT //single comment /*1. Airtime 2. Transfer 3. Balance */ single line # a python program to display multi line comment """ 1. Airtime 2. Transfer 3. Balance """ print() """ # lab1 print("We are learning Artificial Intelligence using Python") #lab2 print("You are welcome")age = 30course = "aritificial intelligence" print(age)print(course) #lab3 print("You are welcome")option = """ author: ajala written date: 26-03-2023 topic: basis of python """ print(option) #lab4a print("You are welcome") age = input("Enter your age") course = input("Enter your course") print(age) print(course) #lab4b print("You are welcome") print("Enter your age") age =
Image
 DATA STRUCTURE WITH C++ PROGRAMMING USING ARRAY AND QUEUE Fact: As architectural design precedes building a house so does SYNTAX precedes programming or coding.  Invariably, you must learn and master the syntax of each construct in a programming language such as variable declaration, initialization, data structure manipulation, loop, selection statement to mention but few, before you start writing the code to solve a problem through the syntax application. What are data structures? Data structures are structures or formats used to organize, store, access, modify and manipulate data elements. The type of problem you are solving will determine the type of data structure you will use. Datatypes in C++ The datatypes in C++ are categorized as: Primitive: They are inbuilt datatypes within C++ and can only store one value at a time; such as int, string, float, double, char, boolean, void Derived: They are made up of the primitive datatypes and they can store more than one value; such as arra