Articles on Trending Technologies

Technical articles with clear explanations and examples

PHP Program for Minimum Number of Jumps to Reach End

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 198 Views

This problem involves finding the minimum number of jumps required to reach the end of an array, where each element represents the maximum number of steps you can jump from that position. Method 1: Naive Recursive Approach The naive recursive approach explores all possible paths from each position and chooses the minimum number of jumps − Minimum number of jumps required to reach the end: 3 Method 2: Dynamic Programming Dynamic programming optimizes the solution by storing results of subproblems to avoid redundant calculations − ...

Read More

kbhit in C language

Nishtha Thakur
Nishtha Thakur
Updated on 15-Mar-2026 2K+ Views

The kbhit() function in C checks if a key has been pressed on the keyboard without waiting for the Enter key. It returns a non-zero value if a key is available to be read, otherwise returns zero. However, kbhit() is non-standard and platform-specific (Windows/DOS only). Syntax int kbhit(void); Parameters None: The function takes no parameters. Return Value Returns a non-zero value if a key has been pressed. Returns zero if no key is pressed. Example Note: This example uses Windows-specific headers (conio.h) and will not ...

Read More

PHP Program for Median of two Sorted Arrays of Same Size

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 266 Views

The median is a value that separates the higher half from the lower half of a data set. When finding the median of two sorted arrays of the same size, we need to merge them conceptually and find the middle elements. This can be done efficiently using a merge-based approach without actually creating a new merged array. Algorithm Approach The solution uses two pointers to traverse both arrays simultaneously, keeping track of the two middle elements needed to calculate the median. Since we have 2n total elements, the median will be the average of elements at positions n-1 ...

Read More

C function argument and return values

Anvi Jain
Anvi Jain
Updated on 15-Mar-2026 10K+ Views

In C programming, functions can be categorized based on two criteria: whether they accept arguments (parameters) and whether they return a value. This gives us four distinct types of functions that cover all possible combinations. Syntax return_type function_name(parameter_list) { // Function body return value; // Optional, depends on return_type } Types of Functions Function with no arguments and no return value − Takes no input and returns nothing (void) Function with no arguments but returns a value − Takes no input but returns a value ...

Read More

PHP Program for Largest Sum Contiguous Subarray

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 384 Views

The Largest Sum Contiguous Subarray problem, also known as the Maximum Subarray Problem, involves finding a contiguous subarray within a given array that has the largest sum. This is a classic algorithmic problem that can be efficiently solved using Kadane's Algorithm. Array: [-2, 1, -3, 4, -1, 2, 1, -5, 4] -2 1 -3 ...

Read More

abs(), labs(), llabs() functions in C/C++

Nishtha Thakur
Nishtha Thakur
Updated on 15-Mar-2026 326 Views

The C standard library provides different functions to calculate the absolute value of integers based on their data types. The abs(), labs(), and llabs() functions handle int, long, and long long data types respectively, returning the non-negative value of their arguments. Syntax int abs(int n); long labs(long n); long long llabs(long long n); The abs() Function The abs() function returns the absolute value of an integer argument. It is defined in stdlib.h and works with int type data − Example #include #include int main() { ...

Read More

ldexp() function in C/C++

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 271 Views

The ldexp() function in C computes the result of multiplying a floating-point number by an integral power of 2. It calculates x * 2^exp where x is a floating-point value and exp is an integer exponent. Syntax float ldexp(float x, int exp); double ldexp(double x, int exp); long double ldexp(long double x, int exp); Parameters x − The floating-point base value exp − The integer exponent representing power of 2 Return Value Returns x * 2^exp. If the result is too large to represent, it returns HUGE_VAL (infinity). Example ...

Read More

PHP Pagination

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 5K+ Views

Pagination in PHP refers to the process of dividing a large set of data into smaller, more manageable sections called "pages." It is commonly used in web applications to display a limited number of records or results per page, allowing users to navigate through the data easily. Pagination is essential when dealing with large data sets because displaying all the records on a single page can lead to performance issues and an overwhelming user interface. By implementing pagination, you can improve the user experience and optimize the performance of your application. How Pagination Works ...

Read More

C qsort() vs C++ sort()

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 665 Views

The qsort() function in C and sort() function in C++ are both used for sorting arrays, but they differ significantly in implementation, performance, and usage. Understanding these differences helps choose the right sorting approach for your program. C qsort() Syntax void qsort(void *base, size_t num, size_t size, int (*comparator)(const void*, const void*)); This function takes the base address of the array, number of elements, size of each element, and a comparator function. C++ sort() Syntax void sort(T first, T last, Compare c); Here T represents iterators, and the order of ...

Read More

What is the use of `%p` in printf in C?

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 12K+ Views

In C, the %p format specifier is used with printf() to display pointer addresses in hexadecimal format. It provides a standard way to print memory addresses stored in pointer variables. Syntax printf("%p", pointer_variable); Example: Basic Pointer Address Printing Here's how to use %p to print the address of a variable − #include int main() { int x = 50; int *ptr = &x; printf("The address is: %p, the value is %d", ptr, *ptr); ...

Read More
Showing 21871–21880 of 61,297 articles
Advertisements