Akansha Kumari has Published 14 Articles

C program to Implement Kadane’s Algorithm

C
Akansha Kumari

Akansha Kumari

Updated on 25-Apr-2025 14:13:32

132 Views

We are given an array of integers, and we need to find the maximum sum of a contiguous subarray using Kadane’s Algorithm. Kadane’s Algorithm is an efficient way to find the maximum subarray sum in O(n) time complexity. For example, in the array {-2, 1, -3, 4, -1, 2, 1, ... Read More

Putting semicolons after while and if statements in C++

Akansha Kumari

Akansha Kumari

Updated on 23-Apr-2025 19:19:08

2K+ Views

In C++, a semicolon(;) indicates the end of a statement in code, or we can say it terminates the statement. When you use a semicolon just after an if or while statement, it creates an empty statement, which executes nothing. Semicolon with If Statement In C++, the if statement is ... Read More

Trigraphs in C++

Akansha Kumari

Akansha Kumari

Updated on 22-Apr-2025 18:50:06

257 Views

Trigraphs in C++ are special three-character sequences that represent a certain single character, which may not be available on some keyboards or systems. Previously, the ISO-646 character set did not have all the characters of the C syntax; therefore, some systems with their keyboard and display faced problems while dealing ... Read More

How to convert a Python for loop to while loop?

Akansha Kumari

Akansha Kumari

Updated on 22-Apr-2025 17:21:10

10K+ Views

Converting a for loop to a while loop in Python means rewriting the loop logic in a different way to perform the same task.While loop gives better control over conditions and is also useful for cases when the number of iterations is not fixed and depends on runtime values. Therefore, ... Read More

Whitespace in C++

Akansha Kumari

Akansha Kumari

Updated on 22-Apr-2025 17:20:57

8K+ Views

The term Whitespace in C++ refers to the characters used for formatting, like creating spaces, tabs, and newlines. These are usually invisible in the source code output (meaning they don't appear in the actual program output); they just help to format the code and improve readability. Types of whitespace characters ... Read More

What is Bitwise AND in C++?

Akansha Kumari

Akansha Kumari

Updated on 21-Apr-2025 12:17:30

190 Views

The Bitwise AND (&) Operator is one of the types of bitwise operators, which perform operations on bits of a binary representation. The Bitwise AND (&) compares each bit of the first operand to the corresponding bit of the second operand and returns 1 if both bits are 1, else ... Read More

What is Bitwise XOR in C++?

Akansha Kumari

Akansha Kumari

Updated on 18-Apr-2025 19:39:12

342 Views

The XOR operator(^), also known as "exclusive OR", is one of the types of bitwise operators, which compares each bit of the first operand to the corresponding bit of the second operand and returns 1 if both bits are different, else returns 0 if both are the same. This only ... Read More

What is the const Keyword in C++?

Akansha Kumari

Akansha Kumari

Updated on 17-Apr-2025 18:50:20

521 Views

The const keyword in C++ is a keyword that is used to declare variables and objects as constant, which means the value declared using const cannot be changed or modified later, once they are initialized. This helps them prevent accidental modifications. For example, in a code, if we ... Read More

What is typedef declarations in C++?

Akansha Kumari

Akansha Kumari

Updated on 17-Apr-2025 18:49:33

458 Views

In C++, typedef is a keyword that is used to create a new name for an existing data type. This helps the users to modify the code according to their preference, making it more readable, friendly, and manageable. Syntax Here is the following basic syntax of typedef in C++; ... Read More

What are shift operators in C++?

Akansha Kumari

Akansha Kumari

Updated on 17-Apr-2025 18:47:39

7K+ Views

In C++, bitwise operators are used to perform operations on binary numbers. Since computers store all data in the form of binary (0s and 1s), therefore, every value, like decimal numbers, characters, and booleans, is internally represented in binary. for example: 5 = 00000101 and 3 = 00000011 To learn more ... Read More

Advertisements