This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* мой strstr стал ещё лучше | |
среднее быстрее чем в обычном strstr | |
Минимальное k+N/k | |
А максимальное кажется примерно такое: | |
k+N*M*... или вроде того, очень много, но оно редкое | |
когда str1 состояит из подстрок одинаковых символов почти равных str2 | |
Подумаю, как от этого избавиться. | |
*/ | |
char * my_strstr(const char * str1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*ееее, я таки слепил strstr на основе сортировки работающего стабильно быстрее | |
стандартного, хотя и требующего дополнительно в параметр - длину строки, | |
хотя max_len ещё можно настроить, что-б ещё побыстрее было | |
скорость кажется такая: | |
P + n/P * ЧТО_ТО_ТАМ | |
где: | |
n=strlen(str1) | |
m=strlen(str2) | |
max_len - это сейчас константа там внутри | |
P=Min(max_len,m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MY_TESTS | |
#define MY_TESTS | |
#include "my_str_str.c" | |
//#include "my_str_strv16.h" | |
void AllTests(); | |
void TestMyStrStr(); | |
void TestGood(); | |
void HTest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MY_STR_STR | |
#define MY_STR_STR | |
#include <stdio.h> | |
#include <malloc.h> | |
#include <string.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#define NO_KEEP_TRACK_OF_TIME 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <malloc.h> | |
#include <string.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <sys/time.h> | |
/*Vaisli | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
удалил чтоб не позорится перед случайно зашедшими по ссылке | |
*/ | |
// | |
public int StrStr(char[] str, char[] pat) { | |
if (str == null || pat == null) | |
return -1; |