[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

ALGORITHMS

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 5

File: 12312312.png (623KB, 1280x720px) Image search: [Google]
12312312.png
623KB, 1280x720px
>Post an algorithm without revaling what it does
>We try to figure out what it is
>>
>>54870799
Dijkstra's algorithm?
>>
var foo = function(arr) {
for (var i = 0; i < arr.length; i++) {
var key = arr[i];
var j = i;
while (j >= 0 && arr[j - 1] < key) {
arr[j] = arr[j - 1];
j--;
}
arr[j] = key;
}
return arr;
}
>>
File: dw8.png (456KB, 568x568px) Image search: [Google]
dw8.png
456KB, 568x568px
collection.push(collection.splice(i, 1)[0]);
>>
>>54870877
Insertion sort that sorts values in an array from highest to lowest
>>
function kek = function(S, W) {
var m = 0;
var i = 0;
var T = foo(W);
while (m + i < S.length) {
if (W[i] == S[m + i]) {
if (i == W.length - 1) return m;
i++;
} else if (T[i] > -1) {
m = m + i - T[i];
i = T[i];
} else {
m = m + i + 1;
i = 0;
}
}
return S.length;
}
>>
File: cables.jpg (502KB, 2048x1536px)
cables.jpg
502KB, 2048x1536px
>>54870799
Hard mode.
Don't think any of you fags can reverse engineer this :)

AAA macro size:req
LOCAL startOfRegion, cloop, movEdxLabel, eaxJump
if USE_AAA
option epilogue:none ; We use a RET in the middle

; Part 1
push esi
pop eax
mov esi, edi
mov edi, eax
push $-6
push 0BBBBDDDDh
xor ecx,ecx
pop dx
movEdxLabel:
mov edx, size
xchg edi, esi
ret

; Part 2
mov eax, [esp-4]
push edi
push ebx
mov ebx, size/4
mov edx, 5A175A17h
xchg ecx,ebx
xchg esi,eax
push eax
mov edi, 0FAFAFAFAh
add esi, 66 ; Offset from esi to end of the macro
or ebx, ecx

cloop:
xor eax,eax
xor [esi+edx*4], edi
shl edi,1
add edi,edx
add edx, 0DDCCAABBh
xchg edx,eax
div ecx
mov eax,ebx
dec eax
jnz eaxJump

pop edi
pop ebx
pop esi
jmp short movEdxLabel+1
eaxJump:
xchg eax, ebx
mov eax, esi
sub eax, 36
jmp eax
startOfRegion:
option epilogue:EpilogueDef
endif
endm
>>
>>54870799
You guys will never find out what it does :^)
for (var i=1; i<=100; i++)    {
if (i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz") }
else if (i % 3 === 0) {
console.log("Fizz") }
else if (i % 5 === 0) {
console.log("Buzz") }
else {
console.log(i) }
}
>>
>>54871111
Gets you through a technical interview in a web dev company.
What do I win?
>>
>>54871111
Nice meme
>>
>>54870799


SqlConnection thisConnection = new SqlConnection(@"Data Source=localhost;
Initial Catalog=default;
Persist Security Info=True;
User ID=user;
Password=B1GT1tti3z");
thisConnection.Open();

string Get_Data =
@"DECLARE @start INT = 1;
DECLARE @end INT = 100;

WITH numbers AS (
SELECT @start AS number
UNION ALL
SELECT number + 1
FROM numbers
WHERE number < @end
)
SELECT *
FROM numbers
WHERE number % 2 <> 0
OPTION (MAXRECURSION 0);";

SqlCommand cmd = thisConnection.CreateCommand();
cmd.CommandText = Get_Data;

SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
var ayy = dt.AsEnumerable().ToList();

foreach (var number in ayy)
{
WriteLine(number.ItemArray[0]);
}
>>
File: File0038.png (170KB, 1893x1745px)
File0038.png
170KB, 1893x1745px
>>
>>54871179
Reduce.
>>
>>54871179
That's an FFT butterfly diagram
>>
>>54871111
Holy fuck sticks quads
>>
>>54871111
Nice quads. Made a shell version because it looks to fucking simliar.

for ((i = 1 ; i <= 100 ; i++)) {
if [ $((i % 3)) = 0 ] && [ $((i % 5)) = 0 ]; then
printf 'FizzBuzz\n'
elif [ $((i % 3)) = 0 ]; then
printf 'Fizz\n'
elif [ $((i % 5)) = 0 ]; then
printf 'Buzz\n'
else
printf '%s\n' "$i"
fi
}
>>
>>54871304
correct
>>
>>54871111
Winner
>>
File: 1437419108754.png (199KB, 413x374px) Image search: [Google]
1437419108754.png
199KB, 413x374px
>>54870947
Serious love
Thread posts: 19
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.