Ignore:
Timestamp:
Apr 15, 2016, 12:03:11 PM (9 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
29ad0ac
Parents:
c5833e8 (diff), 37f0da8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into gc_noraii

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/searchsort.c

    rc5833e8 r0f9e4403  
    1111// Created On       : Thu Feb  4 18:17:50 2016
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Wed Feb 17 12:21:04 2016
    14 // Update Count     : 46
     13// Last Modified On : Tue Mar 22 22:16:46 2016
     14// Update Count     : 55
    1515//
    1616
     
    3636                sout | *v | ", ";
    3737        } // for
     38        sout | endl | endl;
     39
     40        // descending sort/search by changing < to >
     41        for ( unsigned int i = 0; i < size; i += 1 ) {
     42                iarr[i] = i + 1;
     43                sout | iarr[i] | ", ";
     44        } // for
     45        sout | endl;
     46        {
     47                int ?<?( int x, int y ) { return x > y; }
     48                qsort( iarr, size );
     49                for ( unsigned int i = 0; i < size; i += 1 ) {
     50                        sout | iarr[i] | ", ";
     51                } // for
     52                sout | endl;
     53                for ( unsigned int i = 0; i < size; i += 1 ) {
     54                        int *v = bsearch( size - i, iarr, size );
     55                        sout | *v | ", ";
     56                } // for
     57        }
    3858        sout | endl | endl;
    3959
Note: See TracChangeset for help on using the changeset viewer.