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 <iostream> | |
#include<stdio.h> | |
int main() | |
{ | |
int n, a=0, b=1, c=1; | |
printf("Ingrese el número para genera la serie Fibonacci "); | |
scanf("%d",&n); | |
if(n==1) | |
printf(" %d ",a); |
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 <iostream> | |
#include<stdio.h> | |
int main(){ | |
int height; | |
printf("Enter the number of levels "); | |
scanf("%d",&height); | |
for (int rows=1; rows<=height; rows++){ | |
for (int whites=1; whites<=height-rows; whites++){ |
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
;;;; Vacuum world | |
(defstructure (random-vacuum-agent | |
(:include agent | |
(program | |
#'(lambda (percept) | |
(declare (ignore percept)) | |
(random-element | |
'(suck forward (turn right) (turn left) shut-off)))))) | |
"A very stupid agent: ignore percept and choose a random action.") |
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
;;;; Agents for the wumpus world | |
(defstructure (wumpus-agent (:include agent (body (make-wumpus-agent-body)))) | |
"The default wumpus agent gets an arrow.") | |
(defstructure (random-wumpus-agent | |
(:include wumpus-agent | |
(program | |
#'(lambda (percept) | |
(declare (ignore percept)) |
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
for j = 1:length(atributo) | |
fz = [atributo(j,1) atributo(j,2) atributo(j,3)]; | |
for i=1:fi | |
% Formula | |
d(i,1) = sqrt(sum((fz-atributo(i,1:3)).^2)); | |
% Almacenar Clase | |
d(i,2) = atributo(i,4); | |
end | |
%Organizar filas en orden ascendente |
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
imprime_arbol :- | |
imprime_arbol(raiz,0). | |
imprime_arbol(Padre,_) :- | |
nodo(hoja,Class,Padre), !, | |
write(' => '),write(Class). | |
imprime_arbol(Padre,Pos) :- | |
findall(Son,nodo(Son,_,Padre),L), | |
Pos1 is Pos+2, | |
imprime_lista(L,Pos1). |
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
\documentclass{article} | |
\usepackage[english,spanish]{babel} | |
\usepackage{latexsym,graphicx} | |
\usepackage{listings} | |
%%% Teclado y lenguaje en español | |
\usepackage[latin1]{inputenc} | |
\usepackage[T1]{fontenc} |
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
\documentclass{article} | |
\usepackage[english,spanish]{babel} | |
\usepackage{latexsym,graphicx} | |
\usepackage{listings} | |
%%% Teclado y lenguaje en español | |
\usepackage[latin1]{inputenc} | |
\usepackage[T1]{fontenc} |
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
% Quicksort. | |
% quicksort( List, SortedList): sort List by the quicksort algorithm | |
quicksort( [], []). | |
quicksort( [X|Tail], Sorted) :- | |
split( X, Tail, Small, Big), | |
quicksort( Small, SortedSmall), | |
quicksort( Big, SortedBig), | |
conc( SortedSmall, [X|SortedBig], Sorted). |
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
% Finding an item X in a binary dictionary. | |
% in( X, Tree): X in binary dictionary Tree | |
in( X, t( _, X, _) ). | |
in( X, t( Left, Root, Right) ) :- | |
gt( Root, X), % Root greater than X | |
in( X, Left). % Search left subtree | |
in( X, t( Left, Root, Right) ) :- |
OlderNewer