Tag:Positive number

  • Stack sequential storage

    Time:2020-12-15

    Array implementation stack Create three files: stackearray. H, stackearray. C, stackearraytest. C stackArray.h #ifndef STACK_ARRAY_H_ #define STACK_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT StackArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a > B returns a […]

  • Circular queue – sequential storage

    Time:2020-11-30

    Array to achieve circular queue Create three files: queuearray. H, queuearray. C, and queuearraytest. C queueArray.h #ifndef QUEUE_ARRAY_H_ #define QUEUE_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT QueueArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a > […]

  • Circular double ended queue sequential storage

    Time:2020-11-29

    Array implementation of circular double ended queue Create 3 files: doubleendedqueuearray. H, doubleendedqueuearray. C, doubleendedqueuearraytest. C doubleEndedQueueArray.h #ifndef DOUBLE_ENDED_QUEUE_ARRAY_H_ #define DOUBLE_ENDED_QUEUE_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT DequeArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a […]

  • Binary heap sequential storage

    Time:2020-11-28

    Implementation of binary heap by array Create three files: heaprarray. H, heaprarray. C, heapararraytest. C heapArray.h #ifndef HEAP_ARRAY_H_ #define HEAP_ARRAY_H_ #ifdef __GNUC__ #define DEPRECATED __attribute__( (deprecated) ) #elif defined(_MSC_VER) #define DEPRECATED __declspec( deprecated ) #else #define DEPRECATED #endif #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif […]

  • Stack chain storage

    Time:2020-11-27

    Linked list implementation stack Create three files: stacklinked. H, stacklinked. C, stacklinkedtest. C stackLinked.h #ifndef STACK_LINKED_H_ #define STACK_LINKED_H_ #ifdef __GNUC__ #define DEPRECATED __attribute__( (deprecated) ) #elif defined(_MSC_VER) #define DEPRECATED __declspec( deprecated ) #else #define DEPRECATED #endif #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT […]

  • Queue chain storage

    Time:2020-11-26

    Linked list realizes queue Create three files: queuelinked. H, queuelinked. C, queuelinkedtest. C queueLinked.h #ifndef QUEUE_LINKED_H_ #define QUEUE_LINKED_H_ #ifdef __GNUC__ #define DEPRECATED __attribute__( (deprecated) ) #elif defined(_MSC_VER) #define DEPRECATED __declspec( deprecated ) #else #define DEPRECATED #endif #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT […]

  • Why is precision lost? Teach you to understand IEEE-754!

    Time:2020-9-27

    Link to the original text: https://ssshooter.com/2020-09… The image above is from Wikipedia. IEEE-754 standard is a floating-point number standard. There are three formats: 32-bit, 64-bit, and 128 bit (the above two pictures are 32-bit and 64 bit respectively, and the structure is consistent). JavaScript uses 64 bit, which is commonly known as “double precision”. This […]

  • [30 day leetcoding challenge] day 3

    Time:2020-7-13

    Hi, everyone. I’m a pig. Welcome to “baby can understand” series special – 30 day leetcoding challenge. This is a small official event for leetcode. As you can see on the official website, from April 1, every day, the official will select a question and complete it within 24 hours to get a small reward. […]

  • 41. First positive number missing

    Time:2020-4-19

    Given an array of unsorted integers, find the smallest positive integer that does not appear. Example 1: Input: [1,2,0]Output: 3Example 2: Input: [3,4, – 1,1]Output: 2Example 3: Input: [7,8,9,11,12]Output: 1Explain: The time complexity of your algorithm should be o (n), and only constant level space can be used. First record all the positive values with […]

  • Implementation of negative number in the bottom layer of computer

    Time:2020-2-6

    Do you really understand negative numbers in Java? From http://blog.csdn.net/candyguy 1、 How to code negative numbers in Java? Java uses “two’s complement” to encode negative numbers. It is a numerical encoding method, which needs to be completed in two steps: first, each binary bit takes the opposite value, 0 becomes 1, 1 becomes 0. For […]

  • IOS – about some rounding methods

    Time:2019-12-6

    1. Direct conversion float k = 1.6; int a = (int)k; NSLog(@”a = %d”,a); The output is 1, (int) is a forced type conversion, which directly discards the decimal part of the floating-point number. 2. Rounding of floor function (rounding down) float k = 1.6; int a = floor(k); NSLog(@”a = %d”,a); The output result […]

  • C Language: Modular Operation between Positive and Negative Numbers (Reprint)

    Time:2019-9-20

    If the operands on both sides of% are positive, the result is positive or zero; if the operands on both sides of% are negative, the result is negative or zero. Before C99, it was not stipulated what the result of modular division would be if one of the operands was negative. C99 stipulates that if […]