# data[].attributes.body
Sometimes we need to display some records and data directly from SQL database, and also have to use the derived data in certain programs as per the requirements. COBOL provides us various options for internal representation of data.

# data[].attributes.attachment_link.readable_text
Sometimes we need to display some records and data directly from SQL database, and also have to use the derived data in certain programs as per the requirements. COBOL provides us various options for internal representation of data.

In order to use an internal representation of data, COBOL provides a USAGE clause to perform the same function.

Types of USAGE clause
DISPLAY CLAUSE => SYNTAX =>
By default, USAGE is DISPLAY

The records are stored in ASCII format (American standard code for information interchange)

FOR EXAMPLE=>
EXAMPLE 1 )
( this command will allot 4 bytes in the memory internally )

s9(5) will allow 5 bytes in memory internally. It does not allot extra memory
EXAMPLE 2 )
( this command will allot 6 bytes in the memory internally )
Certain data representations for better understanding of memory allotment
Computational clause can be further divided amongst four different types of computations

1. COMP or COMPUTATIONAL

2. COMP - 1 or COMPUTATIONAL - 1

3. COMP - 2 or COMPUTATIONAL - 2

4. COMP - 3 or COMPUTATIONAL - 3

5. COMP - 4 or COMPUTATIONAL - 4 - this clause is almost equal to Binary, i.e., COMP and is barely used these days.

COMP =>
COMP is used to store data in binary format and can be used only for whole numbers. We can not include any decimal number under the COMP clause.
SYNTAX =>
If ' z ' = 1 to 4, then 2 bytes of memory will be allocated

If ' z ' = 5 to 9, then 4 bytes of memory will be allocated

If ' z ' = 10 to 18, then 8 bytes of memory will be allocated
EXAMPLE =>
2 bytes of the memory location will be allocated

Will occupy 4 bytes of the memory location
Pictorial representation of data about how much memory is allocated. COMP - 1 =>
COMP - 1 is used to store hexadecimal from in a single-precision floating-point.

This must not contain a picture clause, and it is an internal floating-point and always occupies 4 bytes of memory.

EXAMPLE =>

Here the allocated memory is 4 bytes and will always remain 4 bytes because the PIC clause is not defined.
COMP - 2 =>
COMP - 2 is used to store hexadecimal from in a DOUBLE precision floating point.

This must not contain a picture clause, and it is an internal floating-point and always occupies 8 bytes of memory

EXAMPLE =>

Here the allocated memory is 8 bytes and will always remain 8 bytes because the PIC clause is not defined
COMP - 3 =>
The doubled precision floating point usually stored as PACKED DECIMAL FORMAT.

We use the PIC clause, and each digit occupies ½ byte.

One byte is equal to 2 nibbles; therefore, ½ byte is equal to 1 nibble, and if any sign is present, it is stored in the rightmost nibble.
EXAMPLE => CALCULATING NUMBER OF BYTES
If z is an even number, then the number of bytes allocated will be derived by
( z / 2 ) + 1.
If z is an odd number, then the number of bytes allocated will be derived by

(z / 2 ) + ( ½ ).
EXAMPLE =>
01 A PIC 9(5) USAGE IS COMP - 3

Number of allocated bytes will be = ( 5 / 2 ) + ( ½ ) = 3 bytes

01 A PIC 9(4) USAGE IS COMP - 3

Number of allocated bytes will be = ( 4 / 2 ) + ( 1 ) = 3 bytes

Either number is signed or unsigned, COMP - 3 will always reserve a nibble of the sign value, even for unsigned values.

# data[].attributes.attachment_link.title
COBOL Internal Representation of Data - Tutorial And Example

# data[].attributes.attachment_link.description
Sometimes we need to display some records and data directly from SQL database, and also have to use the derived data in certain programs as per the requirements. COBOL provides us various options for internal representation of data. In order to use an internal representation of data, COBOL provides a USAGE clause to perform the same function.

# data[].attributes.body
Within the CPU, we have small- small storage units called registers.

# data[].attributes.attachment_link.readable_text
Within the CPU, we have small- small storage units called registers. If we are executing a certain program within the CPU, there's a need to store that program content, we need a storage device, or small memories that reside inside the CPU called registers. Registers are small memory within the CPU used to execute instructions.

Normally, there are various types of registers used in the Central processing unit:-

General Purpose registers

Special purpose registers

Accumulator(AC)

Program Counter(PC)

Instruction Register (IR)

Stack Pointer(SP)

Flag Register / Program Status Word (PSW)

Address Register (AR) / Memory Address Register (MAR)

Data Register (DR) / Memory Data Register (MDR) / MBR

General Purpose Registers

The general-purpose registers store the available content or data. At the time of different operations in the microprocessor in CPU, the general-purpose registers are used to store temporary data like input data for ALU (Arithmetic logic unit), Output for ALU, some intermediate result, any general content user wants to store in the CPU is stored in general-purpose registers. Microprocessor 8086 has eight general-purpose registers.

A detailed description of all general-purpose registers.

Registers
Description/ Function

AX

AX is normally considered an accumulator of 16 bits, and it is divided into two parts of 8 bits named AH or AL. AX is used for arithmetic and logic operations.

BX

BX is a base register pair consisting of BH and BL. This register is used to hold the address of a procedure or to store the offset values.

CX

CX is a count register consisting of two parts CH or CL. It is a control register that is typically used for looping.

DX

DX is a data register consisting of two parts DH and DH. It is ALU for division, multiplication and input/output addresses.

SX

SX works like a stack pointer in the stack to point out the stack's topmost element.

BP

BP is a base point register among the index registers. It is a 16-bit register, and it's offset from the SS register to locate variables on the stack.

SI

SI is the source index register used for copying a string, and its offset is relative to the data segment.

DI

DI is a destination index used to find the destination for copying strings.

SP

SP is a stack pointer register among index registers used to locate the stack's topmost position.

CS

CS is a code segment register that contains the base location of the program code.

DS

DS is the data segment register that tells the base location for the variable of the instruction.

SS

SS is the stack segment register, which tells the base location of the stack.

ES

ES is the extra segment register that contains the additional base location for variables in memory.

Special Purpose Registers

We store some unique content in Special Purpose registers like it holds program state(Wait, Hold, Running). Special purpose registers are also implemented in some specific microprocessors but here, we discuss the basic registers used commonly in all the systems. Let's learn registers with their working.
Accumulator (AC)
Accumulator register is used to store the result of ALU (arithmetic logic unit) operations and sometimes store one of ALU inputs.

General Architecture -During operation, ALU generally required two inputs (it can be one) called operands. ALU performs operations ( like addition, subtraction, division, multiplication etc.) on the input operand, and after performing operations, ALU generates results. In basic Storage design, these results are generated firstly in Accumulator, and then further it is copied or transferred to the user requirement, it may be memory or register.

Accumulator based architecture - A specific architecture/ design of CPU says that when CPU takes two inputs, and both the inputs should be going for ALU, one of the inputs should be taken from Accumulator, and the other input can be taken from anywhere. The result of the performed operation is stored in Accumulator, and this specific design is called Accumulator based architecture.

So, we have to learn different- different kinds of architecture.

Type of Architecture (based on Input to ALU)

Accumulator (AC) based architecture.

Accumulator architecture says that one input should be taken from Accumulator. So here ALU takes two inputs, and one input should be necessarily coming from Accumulator and result will be copied in Accumulator and other input can be taken from anywhere (from any register R0, R1, R2, R3 ....) so CPU mention the other operands like ADD R3(from where the second operand is coming because first one is taken from the Accumulator)

Register-based architecture

The register-based architecture says that ALU takes both the inputs from registers only. ALU takes two inputs only from general-purpose registers, and the result is generated in Accumulator. So if the CPU is using register-based architecture, then every single input is coming from registers only.

Register to memory-based architecture

In register to memory-based architecture, one of the inputs comes from the register, and the second operand can come from memory. ALU operates on both the operands.

Complex System Architecture

In Complex system Architecture, inputs will be taken from anywhere. It means we can take both the input from either memory or the register. It is complex architecture as input can be taken openly, and the result is generated in Accumulator.

Stack base Architecture

In stack-based Architecture, both the input will be taken from the stack. Here operands are stored in stacks automatically on which operations are performed.

32-bit architecture of CPU

This concept says that when the CPU is implemented or designed, it has a maximum ALU capability. If ALU takes two inputs of size 32 bit each and performs operations like addition, subtraction, multiplication, and division, the system is called a 32-bit architecture system. The size of the Accumulator is based on the size of two inputs.

64-bit architecture
This concept also says that ALU can accept two inputs with a maximum word size of 64 and perform operations like addition, subtraction, multiplication, and division on them and generate Accumulator result. The system is called a 64-bit architecture system. The size of the Accumulator is based on the size of two inputs.

Program Counter(PC)

The program counter register is used to store the address of the next instruction. For example, the CPU is executing some instruction which is stored on address 500. Next, instruction is stored on address 502 because it can be possible that instruction takes two memory unit to execute. If the next instruction is stored at 502, then the PC's value (program counter) is 502. If this next instruction goes for execution, then the PC value changes and the next instruction is stored on a new address, and the process goes on like this.

Instruction Register (IR)
The instruction register is used to store the current instruction, executing by the CPU. The instruction register stores the current instruction fetch by CPU from memory. The IR stores this fetched instruction to execute the process.
Stack Pointer (SP)
In the memory for the execution purpose, there is a stack, and the stack works on LIFO(last in first out) principle, which means that whatever element is stored last on the stack is called the top of the stack and pointed first by the stack pointer. So within the CPU, we have a stack pointer that holds the value of the top of the stack element inserted at last.

A stack pointer is used to store the address of the top element of the stack.

Flag Register / Program Status Word (PSW)
The flag register is also called a status register. As we learned before, ALU performs operations on the two input operands, and the result is stored in Accumulator, but here ALU generates two types of output. One of the outputs is generated as a result and stored in Accumulator, and the second output is the status of that result. Status is stored in the status register/flag register. The status register has a small, single bit given for one-one flag, so one flag is for S, and one is for Z.

S stands for Sign(0, 1), and Z stands for Zero( value of Z can be Set1 or Reset0)

Working: Suppose, here, ALU performs an addition operation on the two input operands stored in Accumulator. The status of the result is stored in the status register. Status register/ flag register consists of many bits given to a single flag. The starting bid is given to Sign S(sign bit), which indicates the Sign flag and the second bit is given to Z(zero bit) having two conditions, Set1 or Reset 0. Now ALU thinks over the stored result whether the result is Zero or not, if addition result is zero, we set flag z as Set1 and zero flag will be reset0 when ALU result does not equal to zero.

Similarly, the sign flag indicates whether the result is positive or negative. If the sign is 0, then the result is positive, and if the sign is 1, the result is negative. So, flag/ status register is used to determine the status of the result.

Question: Why this status/ Flag register is used?

Solution: This status or flag register is used to check the conditions. For example: if we want to check if a > b or not. To check the condition, CPU will perform a function "a-b" in ALU, and the result is stored in ALU and the status of the result in the flag register; if the status of that result is positive, it means the condition is true that "a is greater than b." Such kind of conditions we write to check is based on the status/ flag register. All those condition checks written in a higher programming language are based on status register content.
Program Status Word (PSW)
In some microprocessors designs or CPU's, this PSW is only the status register. According to some other scientists in some CPU's PSW, it has been taken as a combination of two registers (Accumulator + status register). So somewhere it is known as status register, and somewhere it is known as accumulator+ status register.
Address Register (AR) / Memory Address Register (MAR)
The address register is used to send the address to memory. The address register is the originating point of the address bus. If CPU wants to send any address to memory for read or write operation then that address first comes to address register and then send through address bus to memory.
Data Register (DR) / Memory Data Register (MDR) / MBR
The data register is used to send data to Memory (Memory write) and receive data from memory (memory read). Any time data are going toward memory or coming from memory, a data register is used. In the memory, for read operation data comes from Memory to CPU, hence the data register is receiving the content through data bus and to execute memory write operation, the same data register is used to send the data back to memory through data bus.

Functioning both registers:- It is a basic CPU design and can be different in some complex CPUs. There are a CPU and a memory. Nowadays, the main memory is designed to have small- small cells. The cell is the smallest part of memory, which is uniquely accessible. Each memory cell has a unique number; with that number, we can access that cell content. Cell number can start from 0, 1,2,3, 4 ......, and these cell numbers are called memory addresses. We can access these cells uniquely with these memory addresses and fetch the required data or information stored in memory very easily. Using the address bus, CPU sends requests to memory to access particular cell memory (cell 1,2,3, can be any).

Two types of operations happen in memory.

Memory read:- (i) CPU sends the address to memory using address bus.

(ii) CPU enables read control signal for memory.

(iii) Memory performs read operations and sends the data to the

CPU using a data bus.

Memory writes:- (i) CPU sends the address to memory using address bus.

(ii) CPU sends data to memory using the data bus.

(iii) CPU send enabled write signal to memory.

(iv) Write operation is performed in memory on the provided

address.

Two control bus signals, controls the operation to be performed by memory, i.e., read signal and write signal for memory. Among these signals, only one signal is enabled for the CPU to access the memory at one time. If the read signal is enabled, memory has to accept the address and read the data/content from that particular cell address, and then memory sends that content to the CPU using "data bus."

If the write signal is enabled, some data is to be written in the memory, then CPU send address and data to the memory where data is to be written using Address bus and Databus.

It is really important to find out the state of memory whether the memory is busy or free to do the CPU operations. So to tell about the memory whether it is working(busy) or free to work, "Wait signal" and "Ready signal" are used. CPU can generate these operations, initiates the memory read and memory write operations only when the ready signal(r=1) will be enabled, and the wait signal(w=0) will be disabled. Firstly, the CPU will check the ready signal is enabled; then, only the CPU will initiate these read and write operations. If the wait signal is enabled, then the CPU cannot initiate any memory operations; the CPU has to wait for the memory to get free to perform operations.

# data[].attributes.attachment_link.description
Within the CPU, we have small- small storage units called registers. If we are executing a certain program within the CPU, there's a need to store that program content, we need a storage device, or small memories that reside inside the CPU called registers. Registers are small memory within the CPU used to execute instructions.

# data[].attributes.attachment_link.readable_text
The Rabin Karp or Karp Rabin algorithm is used to matching a specific pattern in the string.

It uses the technique of hashing to match a specific text.

There also exists a naive algorithm for pattern matching. The naive algorithm iterates in the whole string one by one matching each character of our pattern.

Rabin Karp works in a different manner. It uses the hash function, a tool in which we match the larger input value to a smaller output value.

The algorithm calculates the hash value of the pattern and the current substring in the given string. If both hash and pattern values match, it then matches the individual letter in a string with the pattern.

So the main task here is to find the correct hash value of the length of the pattern then match it.

The hash function in this algorithm calculates an integer value, and this integer value of the string is basically the numeric value of the string.

As there can be larger values of pattern, the numeric values cannot be stored in the form of integers. This optimization is done using modular arithmetic.

We need to rehash again to delete the last integer and add the new one in an optimized manner.

It can be done by following formula:

Let us consider string length n pattern length m.
hash( text[s+1 .. s+m] ) = ( d ( hash( text[s .. s+m-1]) - text[s]*h ) + text[s + m] ) mod q hash( text[s .. s+m-1] ) : Hash value at shift s. hash( text[s+1 .. s+m] ) : Hash value at next shift (or shift s+1) d: Number of characters in the alphabet q: A prime number h: d^(m-1) Explanation of the above expression:
Using the idea of simple mathematics, compute the decimal value of the current window from the previous window.

For instance, Consider the pattern length is 3 and string is "23456"

After computing the value of the first window (which is "234"), the length comes as 234.

Moving ahead for the new window "345",

We will apply the formula by eliminating 200 and add 5 (234 - 2*100)*10 + 5 and get 345.
C++ code: C code - Time complexity:
Best case and average case: O(n+m)

Worst Case: O(nm); When all characters are the same in the string as a pattern

# data[].attributes.attachment_link.title
DAA: Rabin Karp Algorithm - Tutorial And Example

# data[].attributes.attachment_link.description
The Rabin Karp or Karp Rabin algorithm is used to matching a specific pattern in the string. It uses the technique of hashing to match a specific text. There also exists a naive algorithm for pattern matching. The naive algorithm iterates in the whole string one by one matching each character of our pattern.

# data[].attributes.attachment_link.readable_text
What is String Operation?

a string is a combination of characters they can be either Literal constants or any type of variables.

moreover, string allows the user to manipulate its length, count, etc
A STRING CAN HAVE MULTIPLE OPERATIONS: -
combining multiple strings to one or to split a premade string into substrings

to find out pattern in the stored string

to replace a single character with another or to replace multiple characters with a group of different characters

STRING HANDLING IS DIVIDED AMONGST TWO DIFFERENT OPERATIONS
STRING OPERATION =>
to combine multiple strings into one single string
UNSTRING OPERATIONS =>
to split a string into smaller substrings
UNDERSTANDING STRING OPERATIONS
SYNTAX =>

SOME JARGON TO LEARN

DELIMITED BY => optional phrase that is used to determine the limits of the string operations.

DELIMITED BY SIZE:- to limit the string based on size

DELIMITED BY SPACE:- to limit the string based on initial space

DELIMITED BY OTHER DELIMITER:- to limit the string based on the delimiter that is defined in the clause.

POINTER => used to point to the starting position of the destination string item.

SYNTAX => WITH POINTER N

where N refers to the NUMERIC literal and

length of the string item > N >= 0

ON OVERFLOW =>

when the size of the destination string is less than the size of the string which is formed after the concatenation

NOT ON OVERFLOW =>

when the size of the destination string is greater than or equal to the size of the string that is formed after the circuit.

This is a successful case concatenation.
SAMPLE PROGRAM -
THIS IS A DEMO PROGRAM TO LEARN AND UNDERSTAND THE CONCEPT OF STRING BY PROPERTY AND HOW TO ASSIGN VALUES TO STRING AND LATER BY DISPLAYING THE RESULT
THE OUTPUT WILL BE
Here in this program, we have assigned a few variables with different values and later manipulating the result using different properties of string to make you clear about each property of string individually.

we have assigned different values to DELIMITED / POINTER / ON OVERFLOW / NOT ON OVERFLOW to clear all the doubts regarding the above topic. with this sample program, you will be able to understand how convenient and easy STRING manipulation is IN COBOL.

SAMPLE PROGRAM -
THIS IS A DEMO PROGRAM TO LEARN AND UNDERSTAND THE CONCEPT OF STRING BY PROPERTY AND HOW TO ASSIGN VALUES TO STRING AND LATER BY DISPLAYING THE RESULT
THE OUTPUT WILL BE
Here in this program, we have assigned a few variables with different values and later manipulating the result using different properties of string to make you clear about each property of string individually.

we have assigned different values to DELIMITED / POINTER / ON OVERFLOW / NOT ON OVERFLOW to clear all the doubts regarding the above topic. with this sample program, you will be able to understand how convenient and easy STRING manipulation is IN COBOL.

UNDERSTANDING UNSTRING OPERATION?
The sole purpose of unstring operation is to split strings into smaller substrings.

SYNTAX =>
SOME JARGON TO LEARN
DELIMITER IN hold - delimiter - 1 =>

This statement Informs the system about the field where the delimiter has to be received.

COUNTS IN Identifier 123 =>

Count field, which contains the final count of each character in that particular receiving field

WITH POINTER Identifier - for - pointer =>

This statement is used to save the final count after reading each character of the sending fields.

Each character read adds 1 to the count.

TALLYING IN tally identifier =>

It contains the field, which is equal to the initial value plus the number of receiving strings.

ON OVERFLOW {imperative statement 1 } =>

OVERFLOW Condition is met when -

1. When identifier - for - pointer < 1.

2. When identifier - for - pointer > length of sending field.

3. All data receiving fields have been used, but the sending field still contains unexamined character positions.

NOT ON OVERFLOW {Imperative statement 2 } =>

This is a case of a successful UNSTRING Operation.
SAMPLE PROGRAM -
THIS IS A DEMO PROGRAM TO LEARN AND UNDERSTAND THE CONCEPT OF UNSTRING BY PROPERTY AND HOW TO ASSIGN VALUES TO STRING AND LATER BY DISPLAYING THE RESULT
THE OUTPUT WILL BE
Here in this program, we have assigned a few variables with different values and later manipulating the result using different properties of unstringing to make you clear about each property of string individually.

We have assigned different values to DELIMITED / POINTER / ON OVERFLOW / NOT ON OVERFLOW to clear all the doubts regarding the above topic. With this sample program, you will understand how convenient and easy UNSTRING manipulation is IN COBOL.

SAMPLE PROGRAM -
THIS IS A DEMO PROGRAM TO LEARN AND UNDERSTAND THE CONCEPT OF UNSTRING BY PROPERTY AND HOW TO ASSIGN VALUES TO STRING AND LATER BY DISPLAYING THE RESULT
THE OUTPUT WILL BE
Here in this program, we have assigned a few variables with different values and later manipulating the result using different properties of unstringing to make you clear about each property of string individually.

We have assigned different values to DELIMITED / POINTER / ON OVERFLOW / NOT ON OVERFLOW to clear all the doubts regarding the above topic. With this sample program, you will understand how convenient and easy UNSTRING manipulation is IN COBOL.

UNDERSTANDING INSPECT ELEMENT OF A STRING?
INSPECT element is used in a string to analyze the string in order to find

the count of occurrence of a particular character / alphabet or substring or to replace

a particular character or group of characters with other character or group of characters

To count the occurrence of an alphabet or character or a substring in a string, we use the TALLY function for the purpose.

EXAMPLE =>

INSPECT input - string TALLYING CNT for ALL SPACES

To replace an alphabet or character or a substring, we use the REPLACING option for the purpose.

EXAMPLE =>

INSPECT input - string REPLACING ALL X BY Y .
SAMPLE PROGRAM -
THIS IS A DEMO PROGRAM TO LEARN AND UNDERSTAND THE CONCEPT OF INSPECT ELEMENT PROPERTY AND HOW TO ASSIGN VALUES TO STRING AND LATER BY DISPLAYING THE RESULT
THE OUTPUT WILL BE
Here in this program, we have assigned a few variables with different values and later manipulated the result using different Inspect element properties to make you clear about each property of string individually.

We have assigned different values to DELIMITED / POINTER / ON OVERFLOW / NOT ON OVERFLOW to clear all the doubts regarding the above topic. We have assigned a string WS-STRING with value " I.AM UN-STRING - EXAMPLE " and later with INSPECT ELEMENT, we have to count the occurrence of character " I " . With this sample program, you will understand how convenient and easy INSPECT ELEMENT manipulation is in COBOL.

SAMPLE PROGRAM -
THIS IS A DEMO PROGRAM TO LEARN AND UNDERSTAND THE CONCEPT OF INSPECT BY PROPERTY AND HOW TO ASSIGN VALUES TO STRING AND LATER BY DISPLAYING THE RESULT AND CHANGING A CERTAIN CHARACTER WITH OTHER.
THE OUTPUT WILL BE
Here in this program, we have assigned a few variables with different values and later manipulated the result using different Inspect element properties to make you clear about each property of string individually.

We have assigned different values to DELIMITED / POINTER / ON OVERFLOW / NOT ON OVERFLOW to clear all the doubts regarding the above topic. We have assigned a string WS-STRING with value " I.AM UN-STRING - EXAMPLE " and later with INSPECT ELEMENT, we have to change the occurrence of character " . " and " A " and replaced with " / " and " - " respectively. With this sample program, you will understand how convenient and easy INSPECT ELEMENT manipulation is in COBOL.

--------------------------------------

# data[].attributes.attachment_link.title
String Handling in COBOL - Tutorial And Example

# data[].attributes.attachment_link.description
a string is a combination of characters they can be either Literal constants or any type of variables.

# data[].attributes.attachment_link.readable_text
What is Queue?

As the name suggests, the queue is the type of data structure that follows the FIFO (First In - First Out) mechanism. In simple words, it is a linear data structure that resembles somewhere like a stack but has the difference of entry and exit in the elements i.e unlike stacks. It is open at both ends. One end is used to insert data (enqueue) and the other end is used to remove data (dequeue).

Queues are just like lines at a ticket counter or a cash-counter where the first entering person is the first exiting person as well.

There is a similar operation of the queue just like the stacks. Some of the operations include:

peek() − Gets the first element of queue without

removing it.

isfull() − Checks if it is full.

isempty() − Checks if it is empty.

These 3 above operations are efficient enough to serve the major two operations of queues and they are:

Enqueue(): Adds or stores item in the queue.

Dequeue(): Removes or prevents access of items in the queue.

Let us now look at some pseudo-codes for understanding operations in queue.

The above operational codes are just the minor steps to approach a problem involving implementations of queues. Let us look at a program to understand the flow control of queues better.
Output:

Explanation:

The above code depicts the flow for adding and removing elements in a queue. To understand how the enqueue and dequeue operations are performed, look at the following algorithm below.
START
1.Initialize a variable of any choice

Algorithm for inserting in Array-Queue:

Algorithm for deleting in Array-Queue:

1.If front==NULL then

2. Print "Queue is Empty"

3. Else

4. ITEM=QUEUE[front]

5. If front=rear Then

6. front=rear=NULL

7. Else

8. front = front + 1

9. END

Note: The above algorithm works for mainly two operations namely enqueue and dequeue. Since these two operations are also associated with other sub-operations like peek(), isFull(), and isEmpty() we can also easily them from the above code.

Analysis of features and implementations

Queues are widely used in sharing single resource serving requests like print, or task scheduling, etc.

Practically, queues are used in the same way the call-centers hold the calls until the representatives are free.

Queues can be used to handle real-time interrupts in the same order they arrive like first in first out.

Complexity Analysis

Note: Queues are used where processing is not required. Processing may not need any priority since the priority queue follows a different approach. Queues follow the same approach as Breadth-First-Search (BFS).

Points to Remember:

1. The point of entry and exit are different in a queue.

2. Tw0 stacks can be used to make a queue.

3. Random access is not allowed in the queue.

4. We cannot simply add or remove elements from the middle of any queue.

5. Inserting operation using an array is costly in the dequeue. This is because all the elements at a specific position need to be shifted by one. It is the same concept of similar people sitting on a bench and one person from one end pushes down the other to accommodate himself.

# data[].attributes.attachment_link.description
As the name suggests, the queue is the type of data structure that follows the FIFO (First In - First Out) mechanism. In simple words, it is a linear data structure that resembles somewhere like a stack but has the difference of entry and exit in the elements i.e unlike stacks.

# data[].attributes.attachment_link.readable_text
First GoLang Program: Writing the program or source code is very easy in the go language. You need to open your text editor and open a new file. You can also open the new file by pressing the ctrl+N button after opening your text editor. Now write the source code in this new file.

Here the first program for you in the go language is given below.

Program of Hello World:

Here a program is given below in which you will how to print a string, i.e., "Hello World". The program is as follows:

Here, your go program is complete. Type it the same in your file as it is given the upside. Now save the file with the .go extension.

Run the program:
Case 1:
You can run your go program on the terminal window or command prompt. Some text editors also provide the command prompt window; you can run your program by running the following command in your command prompt:
Case 2:
If you are using a simple text editor like notepad, you can run your go program on your system's command prompt. Follow the given steps to run your go program easily:
Step 1:
First of all, open your command prompt.

It is easy to open the command prompt. Press the window+R key from your keyboard, and a pop-up box displays on the screen i. e. Run box. Type "cmd" inside the open bar and press Okay to proceed.

Step 1.1:
When you click on the okay button, then a command prompt window appears on the screen.

Step 2:
Now change the directory to that folder where your file is saved with the help of the "cd" command.

Step 3:
Now type the go command to run the go file. The command is:

Step 4:
Congratulations..!! Now your go file will be executed successfully. If there will be no error in your go source code, then your go program will run successfully and give the result; otherwise, it will display the respected error you made in your program.
Output:

Explanation of the Go Program:

package main: In the first line of every go program, there will always be a package declaration, which means every go program will start with the package's declaration. It is necessary to include the main package in your go program. Packages are used to organize the source code and provide the reusability of the program's codes.

There are two types of programs available in the go language, which are:

Import fmt: The second line of your go program >> is import "fmt"; the import is a keyword of the go language used to import the packages in your go program. Here it is importing the fmt package, also known as format package. The fmt package provides formatted input and output implementation with the functions in the go program.

Func: func is stood for function. Func is a keyword of the go language used to create or declare a function in the go program.

Main(): Main() is the function of the go language. The execution process of the go program will start from here. This function is a non-return type function, which means it does not return any value in the program. It is also a non-parameterized function means no parameters will be declared with this function. The compiler runs the main function of the program firstly. It will call itself automatically when you execute the program. The entire go program starts from here. You can say that the main() is the body of your go program. All the codes will be written inside the main section.

Println(): Println stands for the print line. Println is a method that is present in the fmt package. This method is used in the go program to display the string. The Go language is a case sensitive language. The first letter of this method, i.e., 'P' always be in the upper case.

# data[].attributes.attachment_link.title
First GoLang Program - Tutorial And Example

# data[].attributes.attachment_link.description
First GoLang Program: Writing the program or source code is very easy in the go language. You need to open your text editor and open a new file. You can also open the new file by pressing the ctrl+N button after opening your text editor. Now write the source code in this new file.