0% found this document useful (0 votes)
8 views2 pages

BCA Math Q4b

Uploaded by

artssatya51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

BCA Math Q4b

Uploaded by

artssatya51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Q4.

b)

Defini ons:

Examples:

Floor Func on:

 Defini on: The floor func on of a real number x is the largest integer less than or equal
to x. In simpler terms, it's the "rounding down" of x to the nearest integer.

 Example: floor(3.7) = 3, floor(-2.3) = -3, floor(5) = 5.

 Proper es:

o floor(x) is always an integer.

o floor(x) <= x.

o floor(x + n) = floor(x) + n where n is an integer.

Ceiling Func on:

 Defini on: The ceiling func on of a real number x is the smallest integer greater than or
equal to x. It's the "rounding up" to the nearest integer.

 Example: ceil(3.7) = 4, ceil(-2.3) = -2, ceil(5) = 5.

 Proper es:

o ceil(x) is always an integer.

o ceil(x) >= x.

o ceil(x + n) = ceil(x) + n where n is an integer.

Computer Science Applica ons:

1. Rounding:

These func ons are fundamental for rounding numbers to the nearest integer, a common task in
numerical computa on.

2. Integer Arithme c:

They are used when you need the integer part of a number or to ensure that results of calcula ons
involving decimals remain in the integer domain.
3. Algorithm Design:

 Array Indexing: In algorithms that deal with arrays, floor and ceiling can be used to
calculate appropriate array indices, especially when working with frac onal values.

 Binary Search: Floor and ceiling are used in binary search algorithms to find the
closest elements in a sorted array to a given value.

4. Data Structures:

They can be used in the implementa on of data structures like heaps or trees, where integer
representa ons are needed.

5. Resource Alloca on:

In resource management, they can be used to determine the number of resources needed for a task
(e.g., rounding up the number of pages to print).

Memory Alloca on:

Paging and Segmenta on:

Loop Itera on Limits:

Hashing Algorithms:

Floor or ceiling may be used in index calcula ons or hash table resizing.

Scheduling Problems:

Tasks that span mul ple me slots may use ceiling to determine total slots.

You might also like