Posts

DSA Lab 7 Program

 Program for implementing Stack using array # include < stdio.h > int maxstack = 10 ; int stack [ 10 ]; int top = - 1 ; int empty (){     if (top == - 1 ){         return 1 ;     }     else {         return 0 ;     } } int full (){     if (top == maxstack){         return 1 ;     }     else {         return 0 ;     } } int peek (){     return stack [top]; } int pop (){     int data;     if ( ! empty () ){         data = stack [top];         top -= 1 ;         printf ( " The data has been Deleted. Your data is %d \n " , data) ;         return data;     }     else {         printf ( " The data Can't be Deleted. Becouse stack is empty \n " ) ;   ...

DSA Lab 8 program

 Program for implementing multiple stack. # include < stdio.h > # include < stdlib.h > struct stack {     int maxstack;     int * stack;     int top; }; int isEmpty ( struct stack * ptr ) {     if ( ptr -> top == - 1 ) {         return 1 ;     } else {         return 0 ;     } } int isFull ( struct stack * ptr ) {     if ( ptr -> top == ptr -> maxstack - 1 ) {         return 1 ;     } else {         return 0 ;     } } int peek ( struct stack * ptr ) {     return ptr -> stack [ ptr -> top ]; } int pop ( struct stack * ptr ) {     if ( isEmpty (ptr) ) {         printf ( " Stack Underflow! Cannot pop from the stack \n " ) ;         return - 1 ;     } else {         in...

2 Mark DSA Question Answers

 2 Mark Question  1. Wright Definition of Algorithm & Flowchart 2. Wright Cases of Algorithm Analysis  3. Wright Method of Time & Space Compatibility 4. What is Data Structure  5. Classification of DSA 6. What is Array 7. What is Stack 8. What is Queue 9. Difference Between Static & Dynamic Memory 10. What is Recursion 11. What is Pointer  12. What is String and wright all method name  13. Wright a Algorithm of insertion of Array  14. Wright a Algorithm of Deletion of Array  -------------------------------------------------------------------------------------------------------------------------- 1. Wright Definition of Algorithm & Flowchart Sure! Let's define both terms: ### Algorithm An *algorithm* is a step-by-step procedure or formula for solving a problem. It consists of a finite set of instructions that, when followed, accomplish a particular task. Algorithms are used in various fields, including mathematics, computer science,...

Data Types Python

Sure! Let’s go through the main data types in Python: numbers, lists, sets, tuples, and dictionaries, along with their methods and examples. 1. Numbers Python supports three types of numeric data: Integers : Whole numbers, e.g., 5 , -3 Floats : Decimal numbers, e.g., 3.14 , -0.001 Complex Numbers : Numbers with a real and imaginary part, e.g., 2 + 3j Example: a = 5 # Integer b = 3.14 # Float c = 2 + 3j # Complex number print ( type (a)) # Output: <class 'int'> print ( type (b)) # Output: <class 'float'> print ( type (c)) # Output: <class 'complex'> 2. Lists A list is an ordered collection of items which can be of different types. Lists are mutable, meaning they can be changed after creation. Methods: append() : Adds an item to the end of the list. extend() : Adds all items of a list to another list. insert() : Inserts an item at a given position. remove() : Removes the first occurrence of an item. pop() : Remove...

Multiplexing and its types

 Sure! Let’s break down multiplexing with simple explanations and examples: Multiplexing: Multiplexing is a technique used in computer networks to combine multiple signals or data streams into one signal over a shared medium. This process allows for efficient use of resources and can significantly increase the amount of data that can be sent over a network . Here are the main types of multiplexing: 1. Frequency Division Multiplexing (FDM) Explanation : Imagine you have several radio stations broadcasting at the same time. Each station uses a different frequency, so you can tune your radio to the specific frequency of the station you want to listen to. Example : FM radio stations. Each station broadcasts on a different frequency, allowing multiple stations to operate simultaneously without interfering with each other. 2. Time Division Multiplexing (TDM) Explanation : Think of a single TV channel that shows different programs at different times. Each program gets a specific time slot...

What is Flow Control in data link layer

 Sure! Let’s break down flow control in the Data Link Layer with an example in simple terms. What is Flow Control? Flow control is a technique used to manage the rate of data transmission between two devices to ensure that the sender does not overwhelm the receiver. This is crucial because the sender might be capable of sending data much faster than the receiver can process it. Why is Flow Control Important? Without flow control, a fast sender could send data at a rate that the slower receiver cannot handle, leading to data loss or the need for retransmission. Flow control ensures smooth communication by regulating the data flow. Types of Flow Control There are two main types of flow control mechanisms: Stop-and-Wait Flow Control Sliding Window Flow Control 1. Stop-and-Wait Flow Control In this method, the sender sends one frame and waits for an acknowledgment from the receiver before sending the next frame. This ensures that the receiver has processed the frame before receiving mo...

Error Detection in Data Link Layer

Image
 Sure! Error control in the data link layer ensures that data is transmitted accurately over a network. It involves both error detection and error correction techniques. Here’s a detailed explanation with examples: Error Detection Error detection involves identifying errors in the transmitted data. Common techniques include: Sure! Let’s dive into the different error detection methods used in the data link layer: VRC, LRC, CRC, and Checksum. 1. Vertical Redundancy Check (VRC) VRC , also known as Parity Check , involves adding a parity bit to each data unit (byte). This parity bit ensures that the total number of 1s in the byte (including the parity bit) is even (even parity) or odd (odd parity). Example: Data to be sent: 1010001 Even parity: Add a parity bit 1 to make the total number of 1s even: 10100011 Odd parity: Add a parity bit 0 to keep the total number of 1s odd: 10100010 At the receiver’s end, the parity of the received data is checked. If it doesn’t match the expected pa...