Skip to main content

Posts

Showing posts from January, 2023

The Fundamentals of Digital Marketing Certification

The Fundamentals of Digital Marketing Certification
Trying to make use of some spare time during these endless lockdowns. I completed The Fundamentals of Digital Marketing course on Google Digital Garage and got certified. This is not a great victory, nevertheless, I celebrate every small step towards a greater goal. #googlegarage #fundamentalsofdigitalmarketing #digitalmarketing

FDS 13

 Practical No: -13 Experiment No. 13: Pizza parlor accepting maximum M orders. Orders are served in first come first served basis. Order once placed cannot be cancelled. Write C++ program to simulate the system using circular queue using array. Code: #include<iostream> using namespace std; #define SIZE 3 int Queue[SIZE]; int front=-1; int rear=-1; int isEmpty() { if(front==rear+1) { cout<<"\n Queue Empty:" ; return(1); } return(0); } int Qfull() { if((rear+1) % SIZE==front) { cout<<"\n Queue Full:\n" ; return(1); } return(0); } void enque(int data) { if(!Qfull()) { if(front==-1) front=0; rear++; Queue[rear]=data; cout<<"\n Inserted :"<<data<<"\n"; return; } cout<<"\n Cannot insert:"<<data<<"\n"; } int deque() { if(!isEmpty()) { int t=Queue[front]; front++; cout<<"\n Front:"<<front<<"\n"; return(t); } } int main() { enque(10); enque(20);...

FDS 12

 Practical No: -12 Experiment No. 12: A double-ended queue(deque) is a linear list in which additions and deletions may be made at either end. Obtain a data representation mapping a deque into a one-dimensional array. Write C++ program to simulate deque with functions to add and delete elements from either end of the deque. Code: using namespace std; #include<iostream> #include<stdio.h> #include<process.h> #define MAX 30 typedef struct dequeue {  int data[MAX];  int rear,front; }dequeue; void initialize(dequeue *p); int isEmpty(dequeue *p); int isFull(dequeue *p); void enqueueRear(dequeue *p,int x); void enqueueFront(dequeue *p,int x); int dequeueFront(dequeue *p); int dequeueRear(dequeue *p); void display(dequeue *p); main() {  int i,x,choice,n;  dequeue q;  initialize(&q);  do  {  cout<<"\n 1.Create \n 2.Insert(rear) \n 3.Insert(front) \n 4.Delete(rear) \n 5.Delete(front)";  cout<<"\n 6.Display \n 7.Ex...

FDS 11

 Practical No: -11 Experiment No. 11: Queues are frequently used in computer programming, and a typical example is the creation of a job queue by an operating system. If the operating system does not use priorities, then the jobs are processed in the order they enter the system. Write C++ program for simulating job queue. Write functions add job and delete job from queue. Code: using namespace std; #include<iostream> #include<stdio.h> #include<conio.h> #include<stdlib.h> #define SIZE 5 void enqueue(int x); void dequeue(); void display(); int FRONT=-1; int REAR=-1; int QUEUE[SIZE]; main() {  int x,ch;  while(1)  {  cout<<"\n 1:Add Job";  cout<<"\n 2:Delete Job";  cout<<"\n 3:Display";  cout<<"\n 4:Exit";  cout<<"\n Enter Your Choice:";  cin>>ch;  switch(ch)  {  case 1:  cout<<"Enter Job:";  cin>>x;  enqueue(x);  break;  case 2: ...

FDS 10

 Practical No: -10 Experiment No. 10: In any language program mostly syntax error occurs due to unbalancing delimiter such as (), {}, []. Write a C++ program using stack to check whether given expression is well parenthesized or not. Code: #include<iostream> using namespace std; const int MAX=20; class Stack {  char expr[MAX];  int top;  public:  Stack()  {  top=-1;  }  void push(char ch);  char pop();  bool isEmpty();  bool isFull();  void display();  void checkParenthesis(); }; bool Stack::isEmpty() {  if(top==-1)  return 1;  else  return 0; } bool Stack::isFull() {  if(top==MAX-1)  return 1;  else  return 0; } void Stack::display() {  if(isEmpty()==1)  cout<<"\n Stack is empty";  else  {  for(int i=0;i<=top;i++)  {  cout<<""<<expr[i];  }  } } void Stack::push(char ch) {  if(!isFull())  {  t...

FDS 9

 Practical No: -9 Experiment No. 9: A palindrome is a string of character that’s the same forward and backward. Typically, punctuation, capitalization, and spaces are ignored. For example, “Poor Dan is in a droop” is a palindrome, as can be seen by examining the characters “poor danisina droop” and observing that they are the same forward and backward. One way to check for a palindrome is to reverse the characters in the string and then compare with them the original-in a palindrome, the sequence will be identical. Write C++ program with functionsa) To print original string followed by reversed string using stack b) To check whether given string is palindrome or not Code: #include<iostream> #include<string.h> #define max 50 using namespace std; class STACK {  private:  char a[max];  int top;  public:  STACK()  {  top=-1;  }  void push(char);  void reverse();  void convert(char[]);  void palindrome(); }; void ST...

FDS 8

 Practical No: -8 Experiment No. 8: Write C++ program for storing binary number using doubly linked lists. Write functionsa) To compute 1’s and 2’s complement. b) Add two binary numbers. Code: #include<iostream> using namespace std; class binary; class node {  node *prev;  bool n;  node*next; public:  node()  {  prev=next=NULL;  }  node(bool b)  {  n=b;  prev=next=NULL;  }  friend class binary; }; class binary {  node *start;  public:  binary()  {  start=NULL;  }  void generateBinary(int no);  void displayBinary();  void onesComplement();  void twoscomplement();  binary operator +(binary n1);  bool addBitAtBegin(bool val)  {  node *nodee=new node(val);  if(start==NULL)  {  start=nodee;  }  else  {  nodee->next=start;  start->prev=nodee;  start=nodee;  }  return true;  } }; void ...

FDS 7

 Practical No: -7 Experiment No. 7: The ticket booking system of Cinemax theatre has to be implemented using C++ program. There are 10 rows and 7 seats in each row. Doubly circular linked list has to be maintained to keep track of free seats at rows. Assume some random booking to start with. Use array to store pointers (Head pointer) to each row. On demand a) The list of available seats is to be displayed b) The seats are to be booked. c) The booking can be cancelled. Code: #include<iostream> using namespace std; class mynode {  public:  char book_stats;  mynode *prev,*next; }; class thetr_cinemax {  public:  mynode *head,*last;  //member functions  void create();  void show();  void book_tkt();  void cancel_tkt();  thetr_cinemax()  {  head=NULL;  } }; void thetr_cinemax::create() //function to create arrangement.  {  mynode *n;  for(int i=0;i<=7;i++)  {  n=new mynode;  n-...

FDS 6

 Practical No: -6 Experiment No. 6: Write a python program to store first year percentage of students in array. Write function for sorting array of floating-point numbers in ascending order using quick sort and display top five scores. Code: # Partition position def top(arr):  n=len(arr)-1  for i in range(n,n-5,-1):  print("top:",arr[i]) def partition(arr, low, high):  pivotVal = arr[high] # arr[low]  i = low - 1  # compare each element with pivotVal  for j in range(low, high):  # partition Low and high  if arr[j] <= pivotVal:  i += 1 #i=0 intially  # swapping data at index i with element at j  arr[i], arr[j] = arr[j], arr[i]  print(arr)  # Exchange the pivotVal with the greater data item specified by i  arr[i + 1], arr[high] = arr[high], arr[i + 1]  return i + 1 # Quicksort def quickSort(arr, low, high):  if low < high:  pi = partition(arr, low, high)  print("Pivot val:",arr[pi]) ...

FDS 5

 Practical No: -5 Experiment No. 6: Write a python program to store first year percentage of students in array. Write function for sorting array of floating-point numbers in ascending order using a) Selection Sort b) Bubble sort and display top five score Code: # Function for Selection Sort of elements def Selection_Sort(marks):  for i in range(len(marks)):  # Find the minimum element in remaining unsorted array  min_idx = i  for j in range(i + 1, len(marks)):  if marks[min_idx] > marks[j]:  min_idx = j  # Swap the minimum element with the first element  marks[i], marks[min_idx] = marks[min_idx], marks[i]  print("Marks of students after performing Selection Sort on the list : ")  for i in range(len(marks)):  print(marks[i]) #<---------------------------------------------------------------------------------------> # Function for Bubble Sort of elements def Bubble_Sort(marks):  n = len(marks)  # Traverse throug...

FDS 4

 Practical No: -4 Experiment No. 4: a) Write a python program to store roll numbers of student in array who attended training program in random order. Write function for searching whether particular student attended training program or not, using linear search and sentinel search. b) Write a Python program to store roll numbers of student array who attended training program in sorted order. Write function for searching whether particular student attended training program or not, using Binary search and Fibonacci search. Code: import array as arr # Accept the Roll Numbers of the students def accept_roll():  a = arr.array('I', [])  no_stud = int(input("Enter the number of Students : "))  for i in range(0, no_stud):  a.append(int(input("Enter the Roll Number : ")))  return a # Print the Roll Numbers of the Students def print_roll(a):  for i in range(0, len(a)):  print("\t", a[i], end=" ")  print() # Linear Search def linear_search(a, x):  f...

FDS 3

 Practical No: -3 Experiment No. 2: Write a Python program that computes the net amount of a bank account based a transaction log from console input. The transaction log format is shown as following: D 100 W 200 (Withdrawal is not allowed if balance is going negative. Write functions for withdraw and deposit) D means deposit while W means withdrawal. Suppose the following input is supplied to the program: D 300  D 300  W 200  D 100 Then, the output should be: 500 Code: l1=[] bal=0 def menu():  print("\n Enter Transaction type:")  print("\n W-Withdraw amount.\n D-Deposit amount: \n B-Stop") def createLog(bal):  menu()  ch=input("\n Enter ur choice:")  if(ch=="B"):  quit()  if(ch=="W"):  print("\n Enter amount to withdraw:")  amt=int(input("Amount:"))  #condition bal must be greater than withdraw  if(bal >= amt):  l1.append("W "+ str(amt))  bal = bal-amt  else:  print("\n Transaction failure"...

FDS 2

 Practical No: -2 Experiment No. 2: Write a Python program to store marks scored in subject “Fundamentals of Data Structure” by n students in the class. Write function to compute following: a) The average score of class b) Highest score and lowest score of class c) Count of students who were absent for the test d) Display mark with highest frequency Code: # Function for average score of the class def average(listofmarks):  sum=0  count=0  for i in range(len(listofmarks)):  if listofmarks[i]!=-999:  sum+=listofmarks[i]  count+=1  avg=sum/count  print("Total Marks : ", sum)  print("Average Marks : {:.2f}".format(avg)) #<-----------------------------------------------------------------------------------------------------> # Function for Highest score in the test for the class def Maximum(listofmarks):  for i in range(len(listofmarks)):  if listofmarks[i]!=-999:  Max=listofmarks[0]  break  for i in range(1,len(...

GALLERY

GALLERY
photos

ABOUT

HTML CSS, VB.net Developer and Java, C programming. With Loves Problem Solving and to Unreval the Mysteries behind the Magic of Computer Programming

Followers

MY PROJECTS

Contact us

Name

Email *

Message *