If algebra is hard for you and looks like the davinci code to you how do you expect to be a programmer?
Does this look like davinci code to you?
[quote]#include <linux/export.h>
DEFINE_MUTEX(pm_mutex);
/* Routines for PM-transition notifications */
static BLOCKING_NOTIFIER_HEAD(pm_chain_head);
int register_pm_notifier(struct notifier_block *nb) { return blocking_notifier_chain_register(&pm_chain_head, nb); } EXPORT_SYMBOL_GPL(register_pm_notifier);
int unregister_pm_notifier(struct notifier_block *nb) { return blocking_notifier_chain_unregister(&pm_chain_head, nb); } EXPORT_SYMBOL_GPL(unregister_pm_notifier);
int pm_notifier_call_chain(unsigned long val) { int ret = blocking_notifier_call_chain(&pm_chain_head, val, NULL);
return notifier_to_errno(ret);
}[/quote]
Or this?
[quote]function quicksort( $array ) { if( count( $array ) < 2 ) { return $array; } $left = $right = array( ); reset( $array ); $pivot_key = key( $array ); $pivot = array_shift( $array ); foreach( $array as $k => $v ) { if( $v < $pivot ) $left[$k] = $v; else $right[$k] = $v; } return array_merge(quicksort($left), array($pivot_key => $pivot), quicksort($right)); }[/quote]
Or this?
[quote] ;; quicksort in assembly by Chuck Liang. ;; quicksort wraps around quickaux
.386p .model flat, C .stack .data .code ;; [ebp+8] is start address, [ebp+12] is end address of partition quickaux proc push ebp mov ebp,esp pushad
mov ebx,[ebp+8] ; start of partition
;; find pivot index:
ploop:
cmp ebx,[ebp+12] ; last cell of partition?
jge qretrn ; no pivot, so exit
mov eax, [ebx+4] ; A[i+1]
cmp eax, [ebx] ; A[i]
jl pfound ; A[i]>A[i+1], pivot found
add ebx,4 ; next cell
jmp ploop
pfound:
;; at this point, ebx holds mem address of pivot
;; now partition into < and >= pivot via repeated swapping.
;; use two counters: ebx and esi. ebx always points to the
;; first cell of second partition (what's >= pivot)
mov ecx,[ebx] ; save pivot in ecx
mov esi,ebx
add esi,4 ; next cell
tloop: ; partitioning loop
cmp ecx,[esi] ; compare pivot against element
jle noswap ; no swap if element >=pivot
;; swap [ebx] and [esi], advance both
mov eax,[ebx]
push eax ; use stack as temp
mov eax,[esi]
mov [ebx],eax
pop eax
mov [esi],eax ; done swap
add ebx,4 ; next cell must still be >= pivot
noswap:
add esi,4 ; goto next cell, preserve ebx
cmp esi,[ebp+12] ; end of partition?
jle tloop ; next iteration of partition loop
;; at this point, ebx holds start addr of second partition
;; (could be pivot itself).
;; make recursive calls to quickaux:
;; first partition:
sub ebx,4
push ebx ; end of first paritition
mov eax,[ebp+8]
push eax ; start of first partition
call quickaux
add esp,8 ; deallocate params
;; second partition
mov eax,[ebp+12]
push eax ; end of second partition
add ebx,4
push ebx ; start of second partition
call quickaux
add esp,8
qretrn: popad mov esp,ebp pop ebp ret quickaux endp
;; the quicksort procedure is just a wrapper around quickaux,
;; for ease of integration into high level language.
;; void quicksort(int *A, int start, int end)
quicksort proc
push ebp
mov ebp,esp
pushad
mov ebx,[ebp+8] ; start addr of array
mov eax,[ebp+16] ; end index of partition
shl eax,2 ; multiply by 4: sizeof(int)==4
add eax,ebx ; eax holds end addr of partition
mov ecx,[ebp+12] ; start index of partition
shl ecx,2
add ecx,ebx ; start addr of partition
push eax ; quickaux expects start and end
push ecx ; addresses of partition as arguments.
call quickaux
add esp,8
popad
mov esp,ebp
pop ebp
ret
quicksort endp
end
;; FYI: quicksort in Prolog:
; pivot([A,B|T],A) :- A > B, !. ; pivot([A,B|T],C) :- pivot([B|T],C). ; ; partition(Pv,[A|T],[A|As],B) :- A < Pv, partition(Pv,T,As,B). ; partition(Pv,[A|T],B,[A|As]) :- A >= Pv, partition(Pv,T,B,As). ; partition(Pv,[],[],[]). ; ; quicksort(A,B) :- ; pivot(A,P), !, ; partition(P,A,L,M), ; quicksort(L,SL), quicksort(M,SM), ; append(SL,SM,B). ; quicksort(A,A).
[/quote]
Just some random code snippets in a variety of languages. You need to really get used to learning arbitrary syntax and if algebra confuses you (which is extremely standardized and simple quite honestly) I think you will have trouble
Make sure you can do algebra and basic math before pursuing this or you may waste your GI bill on a topic you can't handle.